Answered step by step
Verified Expert Solution
Question
1 Approved Answer
Programming Language C Sharp Instructions: Create a class called Person that has the following public member variables: Age (int) FirstName (string) LastName (string) Spouse (Person)
Programming Language C Sharp
Instructions: Create a class called "Person" that has the following public member variables: Age (int) FirstName (string) LastName (string) Spouse (Person) The Person class should also have the following public static variable: .SumofAlIAges (double) The Person class should also have the following public methods: .GetFullName (string) .PrintNameAndAge (void) In your main program, you will declare two variables of type Person named "p1" and "p2" Ask the user to provide you with the name, age, and marital status of both individuals. Also, ask for the first name and age of their spouses. While you are doing this, keep track of the sum of all ages in the static variable you made. You can assume the spouse automatically gets the same last name as the individual Don't forget to set the "Spouse" variable to the appropriate value for all four people. After you have collected this information: Invoke "PrintNameAndAge()" on each of the four people. .Print out the single average age of the people. (SumOfAllAges/4) You may only have 2 "Person" type variables local to the Main Program. (p1 and p2) The spouses must be referenced through the "p1.Spouse" and "p2.Spouse" variables. NOTE: It is always encouraged to use methods anywhere in which potential code reuse can be achieved to make your code shorter more efficient and reusable. You may also create any additional classes, objects or methods that you feel make your design betterStep 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