Question: C++ Create a Stack class to perform push and pop operations. For the purpose of this exercise, make the capacity to be 3 Create a
C++ Create a Stack class to perform push and pop operations. For the purpose of this exercise, make the capacity to be 3 Create a PushToFullStackException class, and a method called what to return an overflow exception message. Provide code to throw and handle such an exception in this class. Create a PopEmptyStackException class, and a method called what to return an underflow exception message. Provide code to throw and handle such an exception in this class. Use this test code
Stack myStk; //Capacity of 3
cout
myStk.pop();
cout
myStk.push(1);
cout
myStk.push(2);
cout
myStk.push(3);
cout

Popping right away EXCEPTION: Your stack is empty Pushing 1st item Pushing 3rd item Pushing 4st item XCEPTION: Your stack is full
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
