Question: 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

  1. 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.

  1. Create the Default Constructure. (public)
  2. Create the Deconstructor. (public)
  3. 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)

  1. ABook::ABook() - Default Constructor
  2. ABook::Insert(string NewItem) - Add item to the Linked List
  3. ABook::SortedInsert(string NewItem) - Add item to the Linked List (sorted)
  4. ABook::Remove(string& item) - Remove element from the top of the stack and return the item.
  5. ABook::~ABook() - Deconstructor. Removes all elements from the list.

Main Method

  1. Declare new List (Hint: ABook Book;)
  2. Declare new string newName.
  3. Declare new string nameToRemove.
  4. Call Book.Insert("Precious"); - Insert Precious into list.
  5. Call Book.SortedInsert("Ken"); - Insert Ken into listed (sorted)
  6. Call Book.SortedInsert("Eileen"); - Insert Eileen into list (sorted)
  7. Call Book.SortedInsert("Frank"); - Insert Frank into list (sorted)
  8. Use Book.Remove to remove each name one at a time and display to screen.
  9. 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

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Programming Questions!