Question: In Java: Create a Data Structure to store a forward looking Family Tree. One Family Tree can have many nodes. Links going back to Grand

In Java:

Create a Data Structure to store a forward looking Family Tree. One Family Tree can have many nodes. Links going back to Grand Parents not necessary. The Data Structure should have following methods:

Add(p : Person) Adds a new person to Family Tree

AddChild(parent : Person, child : Person) Adds a child to an existing person in Family Tree

AddPartner(p : Person, partner : Person) Add a partner to an existing person in Family Tree

Display(p : Person) Displays list of all the persons related to given person

Person Class

Person : Class

Name: string

DOB: date

DOD: date

Gender: bool (True: Male, False: Female)

Partners: ArrayList

Children: ArrayList

Sample Display Format

Starting Person : John Doe (Male)

- Mary Jane (Partner, Female)

-- Jim Doe (Child, Male)

-- Jennifer Doe (Child, Female)

--- Tim Clark (Partner, Male)

--- Jesse Clark (Child, Female)

- Nicole Doe (Partner, Female)

-- Nick Jonah (Partner, Male)

-- Nancy Jonah (Child, Female)

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!