# CS 144 Assignment 10. Genealogy Tree solution

\$29.99

Category:

## Description

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
for Charles:
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.
2
Expected output
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
functions:
• 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
solution.
Rubrics
Criteria Max points
Correct program output (as determined by CodeCheck)
• Positions of the names in the tree
• Vertical and horizontal lines
40
• 20
• 20
Recursive functions
• print
• print_bar
• ~Person
60
• 20
• 20
• 20
Charles (Mary)
|
+—Susan (Bob)
| |
| +—Dick (Cindy)
| | |
| | +—Ron
| |
| +—Harry
|
+—George
|
+—Tom (Alice)
|
+—Eliza (Bud)
|
+—Emily (Carl)
| |
| +—Tim
|
+—Charlotte (Frank)
|
+—Carol
|
+—Sara
deleted Ron
deleted Dick
deleted Harry
deleted Susan
deleted George
deleted Eliza
deleted Tim
deleted Emily
deleted Carol
deleted Sara
deleted Charlotte
deleted Tom
deleted Charles