Question: (C++) It should be written in only C++ and please follow the instruction thoroughly. It is about Class(Family tree) For this part, you are building
(C++)
It should be written in only C++ and please follow the instruction thoroughly.
It is about Class(Family tree)
For this part, you are building a family tree starting at you (the base) and going to past generations. You should start yourself out without a predefined name (just say Unknown if no name has been given yet). From here you should repeatedly give the user the following options until they choose to quit: g = give a name to the current person in the family tree. (You may assume names will be single words.) If they already have a name, it should replace the old one. m = change the current person to the mother currently displayed d = change the current person to the father currently displayed b = go back to you, the starting person of the tree (or the base). q = quit the program (without crashing or leaking memory).
Your code must contain the following: 1. A person class with: ? A constructor ? A destructor ? Contains a person pointer to the mother ? Contains a person pointer to the father ? A string to hold the persons name 2. A person pointer to keep track of the current pointer
I strongly recommend you initialize your pointers to NULL, and use this to check and see if the pointer actually contain content. You should make the parents (both mother and father) of the current person when g is selected to give a name. However, choosing g should not erase your current parents if they already exist. If a pointer does not actually point to a person, show their name as ???. If you choose m or d to change to your mother or father, you should only change if the mother or father actually exists. If the pointer is not pointing to an object, you should stay at the current person.
**Output should be exactly the same with the below output.



You must ensure that all dynamic memory is properly deleted at the end of your program. Example1 (user input is underlined) You are currently at Unknown Your mom is ?? Your dad is: ??1 Do you want to (g) ive a name, goto the (m) om, goto the (d)ad, (b) ack to starting person, or (q)uit? You are currently at Unknown Your mom is ?? Your dad is: ??? Do you want to (g) ive a name, goto the (m) om, goto the (d)ad, (b) ack to starting person, or (q)uit? What name (single word)? Alice You are currently at: Alice Your mom is: Unknown Your dad is: Unknow Do you want to (g) ive a name, goto the (m) om, goto the (d)ad, (b) ack to starting person, or (q)uit? m. You are currently at Unknown Your mom is ?? Your dad is: ??1 Do you want to (g) ive a name, goto the (m) om, goto the (d)ad, (b) ack to starting person, or (q)uit
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
