Background

The List class you modified in project 1 can be used as the storage for entries in a Stack class and as the storage for entries in a Queue class.

The required List operations for the Stack class are the default constructor, the destructor, and the methods insertAsFirst, returnFirst, removeFirst, and empty. All except returnFirst were part of the List class of project 1.

The required List operations for the Queue class are the default constructor, the destructor, and the methods insertAsLast, returnFirst, removeFirst, and empty. All except returnFirst were part of the List class of project 1.

All of the required List operations should run in O(1) time.

Task 1

Add a new method to the List class, returnFirst. This method will return the first entry in the linked structure and run in constant time.

Task 2

Write a Stack class. This class will have one data member, a List object. It will store doubles.

This class will have a default constructor, a destructor, and the methods empty, pull, peek, and push.

Task 3

Write a Queue class. This class will have one data member, a List object. It will store doubles.

This class will have a default constructor, a destructor, and the methods empty, pull, peek, and push.

Task 4

Use StackQueueDriver.cpp to test your Stack and Queue classes.

Do not change the driver code. Compile and run it with your Stack.h and Queue.h files.

Run the code for lists of 5, 1, and 0 doubles. Move the output to a single text file, perhaps using Notepad.

Files I require :

Your List, Stack, and Queue code. The output from the three runs of the driver code.

Academic Honesty!
It is not our intention to break the school's academic policy. Posted solutions are meant to be used as a reference and should not be submitted as is. We are not held liable for any misuse of the solutions. Please see the frequently asked questions page for further questions and inquiries.
Kindly complete the form. Please provide a valid email address and we will get back to you within 24 hours. Payment is through PayPal, Buy me a Coffee or Cryptocurrency. We are a nonprofit organization however we need funds to keep this organization operating and to be able to complete our research and development projects.