In this assignment, you implement a genealogical (family) tree. Each node must have a reference to zero or more children and to exactly one parent. Each node also has a reference to the person's name.
The references to the children should be stored as an array of nodes. When an additional child must be stored, the array should be replaced with an array that is one larger. You may or may not store the number of children explicitly, but the number of children should always be equal to the size of the array. If there are no children, the reference to the array should be null.
The reference to the parent will be null for the root of the tree.
You must provide a class to implement the nodes, with a method to allow adding a child, and appropriate accessor methods. You do not need to have any methods to remove references to children or the parent. Your only constructor should take as argument the person's name and the parent (which may be null).
You must also provide a class to implement the family tree itself. Assume that this family tree has a single root, and each person's name is unique. Your class must provide a method to add a child given the parent's name. To implement this method, you will have to search through the tree until you find the specified parent (if there is no such parent, be sure to take appropriate action). The class must include a toString method which converts the entire tree to a string, with nodes appearing in preorder.
The first person to be added will always be the root, whose parent's name is a null reference. The second person to be added will be the first child of the root.
Finally, to test your code, write a main method (in the class representing the family tree) to build two family trees. You may use your mother as the root of one tree and your father as the root of the other tree, or any two of your grandparents, or you may be creative if you prefer. Whatever you choose, your name should appear in both trees, and not at the root. Then print these two trees.
This assignment is meant to be simpler than the last. The hardest part for some of you is probably going to be writing the node class, and searching through the tree. The tree is not in sorted order, so you have to search (potentially) every node in order to find a specific name. The remainder of the assignment should be straightforward and, hopefully, even fun!
You can use the method equalsIgnoreCase (from the string class) to do a case-independent string comparison.
Put your version of all your classes into a single file, and submit that file to the TA for grading (after naming the file LastNameFirstName9). Include all files needed to run your program.
Email your assignment to the TA following the instructions here.