Question
Objective The purpose of this lab is to practice creating classes in C# using the object initialization techniques we looked at this week. Details i.
Objective The purpose of this lab is to practice creating classes in C# using the object initialization techniques we looked at this week. Details i. Create a Visual Studio C# Console project named COMP3602Lab02. ii. Write a class named Member in a separate source (.cs) file with the following: Three Property Methods named FirstName, LastName and Age (use appropriate data types) A Calculated Property Method named AgeInDecades (use an appropriate data type and calculation) Override the ToString method to return Firstname Lastname. Use a composite string rather than the + operator to concatenate the properties. iii. In the Main method in the Program class do the following: Instantiate five Member objects using the Object Initializer syntax and add them to an array. Using a loop, iterate through the array and emulate the output shown in the screen shot below: (use composite strings) Place the output (UI) code in a utility method in a dedicated class (in a separate source file)
\begin{tabular}{llrr} \hline FirstName & LastName & AgeYears & AgeDecades \\ \hline Tim & Conway & 61 & 6.1 \\ Larry & Sanders & 60 & 6.0 \\ Howard & Stern & 58 & 5.8 \\ Steven & Wright & 56 & 5.6 \\ Lewis & Black & 64 & 6.4 \end{tabular}
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started