Question: CS2013 2 Lab 9 Description Create a FamilyTree data structure. The FamilyTree is a structure of Nodes and has two roots. Do not be misled


CS2013 2 Lab 9 Description Create a FamilyTree data structure. The FamilyTree is a structure of Nodes and has two roots. Do not be misled by the word "tree;" this is not a tree according to the definition used in CS. It is somewhat like a linked list and somewhat like a tree. FamiryTree implements the following interface: public interface FamilyTree t public void add(Person self, Integer pl, Integer p2) public set getall public set Person > getDescendants (int nodeNum) : public List Person > getParents (int id) publie Person getPersonById(int id) public List getPersons ByName (String lastName, String firstName): public int size)i Person implements Comparable Person> and has Strings for first name and last name, an .equals() method, getters, setters, and at least one constructor. It also has two GregorianCalendar references for date of birth and date of death. Person's toString() should be carefully thought out to show this information, including the dates, in a clear way. am intentionally leaving it to you to look up how to work with GregorianCalendar, which is not as straightforward as you might expect Review the material on LinkedLists to recall how a Node relates to its data object. Node implements Comparable , and also contains the following a unique id number. I suggest you provide the id with an instance variable in your FamilyTree implementation class that is incremented every time a Node is added to the tree. "Important I will use JUnit tests that assume the first node you add to your tree receives id 1, not 0. a reference to one Person, the data value for this Node. I suggest you name the variable "self" two references to parent Nodes, although one or both of these may be null if the parents are not in the tree . a list of child Nodes containing zero or more references to the Nodes representing Selfs children. Always instantiate the list when the Node is created. . any constructors, getters, setters, and other methods you find necessary a toString0 method that appends the node id in some clear way to the toString) from the Person the node represents (eg, "Node 1: Bob Smith") CS2013 2 Lab 9 Description Create a FamilyTree data structure. The FamilyTree is a structure of Nodes and has two roots. Do not be misled by the word "tree;" this is not a tree according to the definition used in CS. It is somewhat like a linked list and somewhat like a tree. FamiryTree implements the following interface: public interface FamilyTree t public void add(Person self, Integer pl, Integer p2) public set getall public set Person > getDescendants (int nodeNum) : public List Person > getParents (int id) publie Person getPersonById(int id) public List getPersons ByName (String lastName, String firstName): public int size)i Person implements Comparable Person> and has Strings for first name and last name, an .equals() method, getters, setters, and at least one constructor. It also has two GregorianCalendar references for date of birth and date of death. Person's toString() should be carefully thought out to show this information, including the dates, in a clear way. am intentionally leaving it to you to look up how to work with GregorianCalendar, which is not as straightforward as you might expect Review the material on LinkedLists to recall how a Node relates to its data object. Node implements Comparable , and also contains the following a unique id number. I suggest you provide the id with an instance variable in your FamilyTree implementation class that is incremented every time a Node is added to the tree. "Important I will use JUnit tests that assume the first node you add to your tree receives id 1, not 0. a reference to one Person, the data value for this Node. I suggest you name the variable "self" two references to parent Nodes, although one or both of these may be null if the parents are not in the tree . a list of child Nodes containing zero or more references to the Nodes representing Selfs children. Always instantiate the list when the Node is created. . any constructors, getters, setters, and other methods you find necessary a toString0 method that appends the node id in some clear way to the toString) from the Person the node represents (eg, "Node 1: Bob Smith")
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
