Write two template classes for managing generic stacks and


Assignment: Generic Stacks and Queues Requirements

Stacks and queues are important data structures in the fields of digital design and computer architecture. This assignment is based on Exercise 3.11.3 in the textbook.

Your task is to write two template classes for managing generic stacks and queues, based on the following requirements:

- Create and submit the files MyStack.h and MyQueue.h (remember that .cpp files are not allowed when defining templates). Ensure that the MyStack and MyQueue classes work properly with the int, float, and char datatypes.

- The maximum size of the stack or queue shall be hardcoded as 10.

- Each class should provide the following public member functions:

o default constructor
o peek: non-destructively returns the value on top of the stack or at the front of the queue. An exception handler should return an arbitrary value and print an error message if the container is empty.

o pop: remove one element from container and return it
o push: insert new element into container
o clear: delete all entries from container
o size: number of elements in container
o full: returns true if the container is full
o empty: returns true if the container is empty

- Overflow and underflow must be handled via exceptions.

Attachment:- Program.rar

Solution Preview :

Prepared by a verified Expert
C/C++ Programming: Write two template classes for managing generic stacks and
Reference No:- TGS02704896

Now Priced at $50 (50% Discount)

Recommended (94%)

Rated (4.6/5)