This assignment will give you practice writing recursive functions.
A genealogy tree for a person shows all the descendants of that person. Here is a tree
You are provided the code that will build such a tree. Each node of the tree is an
instance of the class Person, which you need to complete.
Your output should exactly match what’s on the right:
• Each person’s name is followed in parentheses
by his or her spouse’s name, if married.
• Each person is followed by his or her children in
order, if any. Each child is in turn followed by his
or her children, if any.
• Note carefully the printing of the vertical bars,
plus signs, and horizontal lines.
Recursive member functions
You must use recursion in at least the following member
• print: Print a person’s name and the spouse
name (if married), then recursively print the
children (if any).
• print_bar: Recursively print spaces and/or
vertical bars before each name (except for the
name at the top).
• ~Person: Recursively delete all the nodes of the
tree. Print the name of the person being deleted.
What to submit
Submit the signed zip file into Canvas:
Assignment 10. Genealogy tree.
You can submit as many times as necessary to get
satisfactory results, and the number of submissions will
not affect your score. When you’re done with your
program, click the “Download” link at the very bottom of
the Report screen to download the signed zip file of your
Criteria Max points
Correct program output (as determined by CodeCheck)
• Positions of the names in the tree
• Vertical and horizontal lines
| +—Dick (Cindy)
| | |
| | +—Ron