Question: ?Need help with the whole program! I provided the pictures for the MathStack from program 19-2 which we are suppose to modify it and implement

?Need help with the whole program! I provided the pictures for the MathStack from program 19-2 which we are suppose to modify it and implement it as a dynamic stack! I did provide how the dynamic stack should look like! Please read the instructions carefully

Carefully review Program 19-2 in your textbook, MathStack. This is a static stack, 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

Make sure you have both high and lower-level validation. Watch out for division by 0 and not having enough integers on your stack to do the operation. Make sure to only allow integers on your stack. Finally, make sure main() is properly organized into functions and don't forget to document your code including your class.

Please submit to us:

1. .cpp and .h files

2. 2 jings, one to show the code operating correctly and one to show error handling?Need help with the whole program! I provided the pictures for theMathStack from program 19-2 which we are suppose to modify it andimplement it as a dynamic stack! I did provide how the dynamicstack should look like! Please read the instructions carefully Carefully review Program19-2 in your textbook, MathStack. This is a static stack, meaning thatthe size of the stack is set at the beginning of the

biets the value is popped off 5 01 top 3 stlackSze 5 10 111 15 12] 20 131 num 2525 141 nues to call the pop function until all the values have been rerieved from The program the stack. enting Other Stack Operations lex operations may be built orcoml dliscuss a class, MathStack, that is derived f on the basic stack class previously shown. In this tack, that is derived from IntStack. The MathStack ion, wewo member functions: add() and sub().The add() function pops the first two s the first two values off the stack, subtracts the second value from the first, ember es off the stack, add the difference onto the stack. The class declaration is as follows: e stack. The s ntents of MathStack.h 1 i Specification 2 #ifndef MATHSTACK_H 3 #define MATHSTACK_H 4 #include "IntStack.h" file for the MathStack class he 6 class MathStack public IntStack 7 8 public: // Constructor MathStack(int s) IntStack(s) 10 // MathStack operations void add (); void sub (); 13 14 16 #endif The definitions of the member functions are shown here: // Implementation file for the Mathstack class 2 #include "MathStack.h" Contents of MathStack.cpp 1 biets the value is popped off 5 01 top 3 stlackSze 5 10 111 15 12] 20 131 num 2525 141 nues to call the pop function until all the values have been rerieved from The program the stack. enting Other Stack Operations lex operations may be built orcoml dliscuss a class, MathStack, that is derived f on the basic stack class previously shown. In this tack, that is derived from IntStack. The MathStack ion, wewo member functions: add() and sub().The add() function pops the first two s the first two values off the stack, subtracts the second value from the first, ember es off the stack, add the difference onto the stack. The class declaration is as follows: e stack. The s ntents of MathStack.h 1 i Specification 2 #ifndef MATHSTACK_H 3 #define MATHSTACK_H 4 #include "IntStack.h" file for the MathStack class he 6 class MathStack public IntStack 7 8 public: // Constructor MathStack(int s) IntStack(s) 10 // MathStack operations void add (); void sub (); 13 14 16 #endif The definitions of the member functions are shown here: // Implementation file for the Mathstack class 2 #include "MathStack.h" Contents of MathStack.cpp 1

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!