Write a stack application program to evaluate post-fix expressions.
The user will enter a post-fix expression of the form
34+ which means 3+4
345+* which means 3*(4+5)
722+- which means 7-(2+2)
as a string. Operators are +, -, and *.
Single digit numbers only. No blanks.
Please note that the expression could be wrong.
e.g.
3+ too few operands (i.e. cannot pop operand)
345 incomplete expression (i.e. more than the result at the end)
Your program will display the evaluated result (a number) or an error message describing what is wrong (the algorithm is in Notes-1, so use it as given).
Required Test Cases (MUST TEST IN THIS ORDER):
1. 34+ which means 3+4
2. 345+* which means 3*(4+5)
3. 722+- which means 7-(2+2)
4. 34+56++ which means (3+4)+(5+6)
5. 12+34*45+-+ which means (1+2) + ((3*4) - (4+5))
6. 1234567891234 expression too long
7. + too few operands
8. 3+ too few operands
9. 3# invalid element
10. 2345+ incomplete expression
NOTE: Do you think I have listed all possible cases? Always ask yourself if there are other cases you should test to make sure your program is bug free.