Question: Use the code for the classes in the given pictures. Summary: Write a complete program to keep track of people and their possible marriages. People

Use the code for the classes in the given pictures.

Use the code for the classes in the given pictures. Summary: Write

a complete program to keep track of people and their possible marriages.

People have a name (you decide the format), age, and sex. Two

Summary: Write a complete program 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.

Most Important: Use good OOP techniques! 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.

import java.time.temporal.ChronoUnit; import java.time.LocaLDate; public class Person private String familyNane; private String givenNames; private LocalDate dob; private int ssn; //max value 10**9: -1 > not assigned private String priorName; private LocalDate nameChangeDate; private Marriage marriage; //a single family name //one or nore given names public Person) familyName"; givenNames"" priorName nameChangeDate null; marriagenull; public Person(String fN, String gNs, int birthDay, int birthMonth, int birthYear) t familyNamefN givenNamesgNs; dobLocalDate.of (birthYear, birthMonth, birthDay) ssn =-1 ; nameChangeDate null; priorName public int getAgeInYears) int age age-(int) ChronoUnit. YEARS.between(dob, LocalDate.now)) return age; public boolean isEighteen0rOverO LocalDate ageEighteen; ageEighteen dob.plusYears( 18; //Person's 18th birthday return !(ageEighteen.isAfter( LocalDate.now))): //age 18 is in past or today for Person public String toString) String ret; ret"Person"familyName. toUpperCase"givenNames "/" dob" return ret; this.getAgeInYears) + "/"this.isEighteen0rOver)+"/" import java.time.temporal.ChronoUnit; import java.time.LocaLDate; public class Person private String familyNane; private String givenNames; private LocalDate dob; private int ssn; //max value 10**9: -1 > not assigned private String priorName; private LocalDate nameChangeDate; private Marriage marriage; //a single family name //one or nore given names public Person) familyName"; givenNames"" priorName nameChangeDate null; marriagenull; public Person(String fN, String gNs, int birthDay, int birthMonth, int birthYear) t familyNamefN givenNamesgNs; dobLocalDate.of (birthYear, birthMonth, birthDay) ssn =-1 ; nameChangeDate null; priorName public int getAgeInYears) int age age-(int) ChronoUnit. YEARS.between(dob, LocalDate.now)) return age; public boolean isEighteen0rOverO LocalDate ageEighteen; ageEighteen dob.plusYears( 18; //Person's 18th birthday return !(ageEighteen.isAfter( LocalDate.now))): //age 18 is in past or today for Person public String toString) String ret; ret"Person"familyName. toUpperCase"givenNames "/" dob" return ret; this.getAgeInYears) + "/"this.isEighteen0rOver)+"/

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!