CS 144 Advanced C++ Programming Assignment #10

$30.00

Category: Tags: , , , , You will Instantly receive a download link for .zip solution file upon Payment || To Order Original Work Click Custom Order?

Description

5/5 - (4 votes)

Assignment 10. Genealogy Tree
Points: 100
Genealogy tree
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
program, click the “Download” link at the very bottom of
the Report screen to download the signed zip file of 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