Answered step by step
Verified Expert Solution
Link Copied!

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 image text in transcribed

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 better

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image_2

Step: 3

blur-text-image_3

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Seven Databases In Seven Weeks A Guide To Modern Databases And The NoSQL Movement

Authors: Luc Perkins, Eric Redmond, Jim Wilson

2nd Edition

1680502530, 978-1680502534

More Books

Students also viewed these Databases questions

Question

Have roles been defined and assigned?

Answered: 1 week ago

Question

What is the difference between Needs and GAP Analyses?

Answered: 1 week ago

Question

What are ERP suites? Are HCMSs part of ERPs?

Answered: 1 week ago