Write an algorithm using any computer language you are most comfortable with to process or evaluate a string that represents a postfix mathematical expression to the correct answer.The postfix expression must support the following Format.
expr:--?[0-9]+
expr : expr expr (+|-|*|/)
Some of the examples of the postfix expression and their respective results are represented below
Postfix Expression | Result |
11+ | 2.0 |
2-3* | -6.0 |
11+23*- | -4.0 |
10 12+2+5++ | 20.0 |
The input to the algorithm is represented in a text file with each line in the file representing a postfix expression. write a console application that
- Reads the file line by line
- process each of the line with your algorithm
- prints is an evaluation of each line to the console
- typing "q" or reading letter q from input should terminate your console applications.
eG EXAMPLE OF INPUT IS BELOW
11+
22*
q
THE CONSOLE APPLICATION PRINTS THE VALUE
2
4
FOR RESULTSthat represent a floting-point number. please use the maximum
precision available to the platform