Answered step by step
Verified Expert Solution
Question
1 Approved Answer
Directions The file must be called unit5-6Prog.cpp 1 structure called AddressNode The structure should contain a string for name and a pointer called AddressNode that
Directions The file must be calledunit5-6Prog.cpp1
structure called AddressNode
- The structure should contain a string for name and a pointer called AddressNode that points to "next" (the next element in the list).
classed called ABook.
- Create the Default Constructure. (public)
- Create the Deconstructor. (public)
- AddressNode* topPtr. (private) - Should be a pointer to the top of the list.
ABook Methods (each of these methods must be created in your program)
- ABook::ABook() - Default Constructor
- ABook::Insert(string NewItem) - Add item to the Linked List
- ABook::SortedInsert(string NewItem) - Add item to the Linked List (sorted)
- ABook::Remove(string& item) - Remove element from the top of the stack and return the item.
- ABook::~ABook() - Deconstructor. Removes all elements from the list.
Main Method
- Declare new List (Hint: ABook Book;)
- Declare new string newName.
- Declare new string nameToRemove.
- Call Book.Insert("Precious"); - Insert Precious into list.
- Call Book.SortedInsert("Ken"); - Insert Ken into listed (sorted)
- Call Book.SortedInsert("Eileen"); - Insert Eileen into list (sorted)
- Call Book.SortedInsert("Frank"); - Insert Frank into list (sorted)
- Use Book.Remove to remove each name one at a time and display to screen.
- Include:system("PAUSE");after your output to pause the screen.
Example output of your program
Sorted List:
Eileen
Frank
Ken
Precious
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started