Question: FOR C++: Carefully review Program 19-2 in your textbook, MathStack. This is a static stack, meaning that the size of the stack is set at
FOR C++:
Carefully review Program 19-2 in your textbook, MathStack. This is a staticstack, meaning that the size of the stack is set at the beginning of the program (see line 11): MathStack stack(5).
I would like you to modify this program as follows:
1. Implement it as a dynamic stack (do not use a static stack as it is designed in the book). Use a linked list to implement this. There's code in the book.
2. Add functionality for Mult, Div, Pop, and Display.
3. Create a looping menu-driven program to demonstrate your code so that the user has the choice of:
1. Push (an integer onto the stack)
2. Pop (an integer off the stack)
3. Add (the top two values in the stack and replace those two values with the sum)
4. Subtract (the top two values on the stack and replace those two values with the difference)
5. Mult (same as above)
6. Div (same as above but check for div by 0)
7. Display Stack
8. End
PLEASE USE FUNCTIONS PLEASE USE LOW LEVEL VALIDATION PLEASE SHOW PROGRAM WORKS WITH A PICTURE PLEASE ADD .h AND .cpp files
This is Program Mathstack:

Implementing Other Stack Operations More complex operations may be built on the basic stack class previously shown. In this section, we will discuss a class, Mathstack, that is derived from Intseack. The Mathstack class has two member functions: add) and subt).The add) function pops the first two values off the stack, adds them together, and pushes the sum onto the stack. The subt function pops the first two values off the stack, subtracts the second value from the first, and then pushes the difference onto the stack. The class declaration is as follows. 6 int main) int catchvar: / To hold values popped off the stack /I Create a MathStack object. Mathstack stack (5) Push 3 and 6 onto the stack cout 3include "Mathstack.h" 4 using namespace std; Implementing Other Stack Operations More complex operations may be built on the basic stack class previously shown. In this section, we will discuss a class, Mathstack, that is derived from Intseack. The Mathstack class has two member functions: add) and subt).The add) function pops the first two values off the stack, adds them together, and pushes the sum onto the stack. The subt function pops the first two values off the stack, subtracts the second value from the first, and then pushes the difference onto the stack. The class declaration is as follows. 6 int main) int catchvar: / To hold values popped off the stack /I Create a MathStack object. Mathstack stack (5) Push 3 and 6 onto the stack cout 3include "Mathstack.h" 4 using namespace std
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
