How to display full name to the console after entering first and last name in C#? [closed]
I have written this code inside Student class:
public string FullName
{
get
{
return FirstName + " " + LastName;
}
}
public void PrintInformation()
{
Console.WriteLine($"Age: {Age} ");
Console.WriteLine($"ID: {StudentNumber} ");
Console.WriteLine($"Full name: {FullName}");
}
FirstName and LastName are inherited from Person class. Inside the Main method:
Student student = new Student();
Console.Write("Please enter first name: ");
person.FirstName = Console.ReadLine();
Console.Write("Please enter last name: ");
person.LastName = Console.ReadLine();
student.PrintInformation();
I am trying to display FullName as a calculated property (firstname+lastname) to the console but I cannot find what is wrong with this code.
c# console properties
New contributor
closed as off-topic by Jesse C. Slicer, 1201ProgramAlarm, Sᴀᴍ Onᴇᴌᴀ, Jamal♦ Dec 24 at 2:37
This question appears to be off-topic. The users who voted to close gave this specific reason:
- "Code not implemented or not working as intended: Code Review is a community where programmers peer-review your working code to address issues such as security, maintainability, performance, and scalability. We require that the code be working correctly, to the best of the author's knowledge, before proceeding with a review." – Jesse C. Slicer, 1201ProgramAlarm, Sᴀᴍ Onᴇᴌᴀ, Jamal
If this question can be reworded to fit the rules in the help center, please edit the question.
add a comment |
I have written this code inside Student class:
public string FullName
{
get
{
return FirstName + " " + LastName;
}
}
public void PrintInformation()
{
Console.WriteLine($"Age: {Age} ");
Console.WriteLine($"ID: {StudentNumber} ");
Console.WriteLine($"Full name: {FullName}");
}
FirstName and LastName are inherited from Person class. Inside the Main method:
Student student = new Student();
Console.Write("Please enter first name: ");
person.FirstName = Console.ReadLine();
Console.Write("Please enter last name: ");
person.LastName = Console.ReadLine();
student.PrintInformation();
I am trying to display FullName as a calculated property (firstname+lastname) to the console but I cannot find what is wrong with this code.
c# console properties
New contributor
closed as off-topic by Jesse C. Slicer, 1201ProgramAlarm, Sᴀᴍ Onᴇᴌᴀ, Jamal♦ Dec 24 at 2:37
This question appears to be off-topic. The users who voted to close gave this specific reason:
- "Code not implemented or not working as intended: Code Review is a community where programmers peer-review your working code to address issues such as security, maintainability, performance, and scalability. We require that the code be working correctly, to the best of the author's knowledge, before proceeding with a review." – Jesse C. Slicer, 1201ProgramAlarm, Sᴀᴍ Onᴇᴌᴀ, Jamal
If this question can be reworded to fit the rules in the help center, please edit the question.
add a comment |
I have written this code inside Student class:
public string FullName
{
get
{
return FirstName + " " + LastName;
}
}
public void PrintInformation()
{
Console.WriteLine($"Age: {Age} ");
Console.WriteLine($"ID: {StudentNumber} ");
Console.WriteLine($"Full name: {FullName}");
}
FirstName and LastName are inherited from Person class. Inside the Main method:
Student student = new Student();
Console.Write("Please enter first name: ");
person.FirstName = Console.ReadLine();
Console.Write("Please enter last name: ");
person.LastName = Console.ReadLine();
student.PrintInformation();
I am trying to display FullName as a calculated property (firstname+lastname) to the console but I cannot find what is wrong with this code.
c# console properties
New contributor
I have written this code inside Student class:
public string FullName
{
get
{
return FirstName + " " + LastName;
}
}
public void PrintInformation()
{
Console.WriteLine($"Age: {Age} ");
Console.WriteLine($"ID: {StudentNumber} ");
Console.WriteLine($"Full name: {FullName}");
}
FirstName and LastName are inherited from Person class. Inside the Main method:
Student student = new Student();
Console.Write("Please enter first name: ");
person.FirstName = Console.ReadLine();
Console.Write("Please enter last name: ");
person.LastName = Console.ReadLine();
student.PrintInformation();
I am trying to display FullName as a calculated property (firstname+lastname) to the console but I cannot find what is wrong with this code.
c# console properties
c# console properties
New contributor
New contributor
New contributor
asked Dec 24 at 0:41
Eneada Sulaj
1
1
New contributor
New contributor
closed as off-topic by Jesse C. Slicer, 1201ProgramAlarm, Sᴀᴍ Onᴇᴌᴀ, Jamal♦ Dec 24 at 2:37
This question appears to be off-topic. The users who voted to close gave this specific reason:
- "Code not implemented or not working as intended: Code Review is a community where programmers peer-review your working code to address issues such as security, maintainability, performance, and scalability. We require that the code be working correctly, to the best of the author's knowledge, before proceeding with a review." – Jesse C. Slicer, 1201ProgramAlarm, Sᴀᴍ Onᴇᴌᴀ, Jamal
If this question can be reworded to fit the rules in the help center, please edit the question.
closed as off-topic by Jesse C. Slicer, 1201ProgramAlarm, Sᴀᴍ Onᴇᴌᴀ, Jamal♦ Dec 24 at 2:37
This question appears to be off-topic. The users who voted to close gave this specific reason:
- "Code not implemented or not working as intended: Code Review is a community where programmers peer-review your working code to address issues such as security, maintainability, performance, and scalability. We require that the code be working correctly, to the best of the author's knowledge, before proceeding with a review." – Jesse C. Slicer, 1201ProgramAlarm, Sᴀᴍ Onᴇᴌᴀ, Jamal
If this question can be reworded to fit the rules in the help center, please edit the question.
add a comment |
add a comment |
active
oldest
votes
active
oldest
votes
active
oldest
votes
active
oldest
votes
active
oldest
votes