computer science

Week 5-6 Programming Assignment

 

Core Learning Outcomes addressed in this assignment:

 

  • Demonstrate creativity and problem-solving skills. (9)
  • Write C++ programs that use proper style and documentation. (10)
  • Write C++ programs that uses a Stack and Linked List. (11)
  • it is C++ program.

 

The purpose of this assignment is to assess if you can create a program that uses a Stack and a Linked List.

 

Directions Points
The file must be called week5-6Prog.cpp 1
Create a 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).
10
Create 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.
10
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.
40
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.

See example below.

10
Ensure you include ALL .cpp file(s) and any associated, student-defined .h (header) files required to make your program compile and run. The only files in the dropbox should be .cpp and .h files.  Do not turn in .zip, .exe, .rar, etc files. 2
Upload your page to the Dropbox.

NOTE: Complete your activity and submit it to the Dropbox by clicking on the Dropbox tab at the top of the course frame and choosing the correct Weekly Activity.

If needed, click on the Help button above for more information on Course Tools/Using the Dropbox.

3

Total Possible Points

76
Example output of your program

Sorted List: 
Eileen
Frank
Ken
Precious

 

Order this or a similar paper and get 20% discount on your first order with us. Use coupon: GET20