Your job is to provide an implementation for a module and a class whose interface is predefined. We are building a postfix calculator called Calc. For details about postfix notation, see Section 14.10 in your textbook (p XXXXXXXXXXYou have been provided with a driver in the form of a main function with a while loop in it. In addition, there is a module called input that contains a couple of routines for validating input. You must implement the routines in the input module. You will find prototypes in input.hpp.
In order to implement postfix notation, you need a stack. You are provided with an interface for a Stack class that uses the vector class from the Standard Template Library (See Chapter 8 in your textbook). You must implement the Stack class according to the class declaration provided in Stack.hpp.
You must hand in two files: one called input.cpp and one called Stack.cpp. The input.cpp file should contain an implementation of the function prototypes in input.hpp. The Stack.cpp file should contain an implementation of the class declared in the Stack.hpp file.
Your implementation must match the interface exactly. I will drop them into a project directory with my own header files and main program, and they should work without modification.
The Calc program is a command-line calculator. When you run it, it shows you a prompt, which is a dollar sign ($). You can type numbers, and you can type mathematical operators. There are five operators: +, -, *, /, and % for add, subtract, multiply, divide, and modulus, respectively. All operators are integer only.
Numbers may be preceded by an optional ‘+’ or ‘-’, followed by one or more digits. This calculator operates on integers only. When you enter a number, it is placed on the stack.
When you enter an operator, the program applies the operator to the top two numbers on the stack. If there are not enough numbers, the program prints an error message. If the operation is successful, the result is printed to the console. The result also remains on the stack top.
You can type ‘p’ to print out the current stack contents. You can type ‘x’ to exit the program.
All other input produces an error message.