Question: Write a complete program (Java) to keep track of people and their possible marriages. People have a name (you decide the format), age, and sex.

Write a complete program (Java) to keep track of people and their possible marriages. People have a name (you decide the format), age, and sex. Two people over the age of 18 may get married if neither one is married currently. Marriages can be annulled or ended any time after which people can marry again. Decide what classes you need first. It is helpful to ask what are the key nouns in the system requirements?

Details and suggestions:

a. Define a good and complete class for Person. Add useful methods (possibly isMarried, canMarry, age,). I suggest you store date of birth and calculate the age the person is today.

b. Be able to print out the current list of people in the system.

c. Think about how you want to identify people (full name, last name, person id, pick from list by index, etc.)

d. Allow multiple people to be added by the user

e. Provide some way to keep track of current marriages (some type of collection may be useful)

f. Allow the user to attempt to marry two (already entered) people, test to see if that is allowed, and confirm the result to the user

g. Allow the user to attempt to end an existing marriage. If it makes sense, update the system and confirm the result to the user

h. Be able to print out the current list of marriages (you pick the format)

i. Be sure there is some way to end the program. Before ending print out the list of all people and the current marriages.

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!