Question: Homework 13 Family Database objectives: Practice ArrayList A ab, e. You are going to write a set ofsupporting classes for people to query their matemal
Homework 13 Family Database objectives: Practice ArrayList A ab, e. You are going to write a set ofsupporting classes for people to query their matemal line, patemal line and children by building a family database. A family database contains genealogical data for family history. You are to implement two classes. You should implement a class called Person that represents a person and stores references to the person's mother, father, and any children the person has. It should have the following public constructor and methods: Person (String personName) o Constructor that takes a person's name as an argument. String getName() o Returns the name of this person. Person get Mother o Returns a Person object that represents this person's mother. Person get Father o Returns a Person object that represents this person's father. int num Kids o Returns the number of children of this person. Person nth Kid (int n) o Returns the nth child of this person (n 0, 1, 2, 3, Notice that n starts from 0 which means the first child and you should handle the case of n being out of bound. void set (Person mother) Mother o Sets the mother of this person. void set Father (Person father o Sets the father of this person. void add Kid Person kid) o Adds the given kid as a child of this person. You should also implement a class called FamilyInfo that store the overall list of Persons in a family history. It should have the following public constructor and method Family Info 0 o Constructor that creates an empty family database. Person get Person (string name) o Returns a reference to the Person with the given name if existing in the database returns null if not found. void read (Scanner input)
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
