Must be done in Java.
In the 1980s HP produced postfix calculators, which enabledpeople to perform arithmetic calculations without usingparentheses. The problem was that we had to first learn how toconvert a \"normal\" arithmetic expression (known as an infixexpression) to postfix before we could use the calculator.
Then the calculator uses a stack to evaluate the expression .The following tutorial shows you how to use a stack to calculatethe result of a postfix expression (and then it has a review of howto convert from infix to postfix. (You need to be able to do thisfor a test).
This program will use a stack to evaluate postfix expressions.The input file will consist of several postfix expressions, one perline. (I suggest you practice with input from the keyboardinitially while you debug your program). In the input file, theoperands will be single digit integers. Output the expression andthe evaluation. For example, if the input was 23+ you should output\"23+ is 5\".
Note: You may assume the only things in the input string aredigits and operators +,-,*,/
As always, document your program. I expect to see the algorithmwritten in the comments.
Make sure you put the input file in the correct place in theproject, zip the folder and submit it.
I am adding 5 points extra credit to this assignment (that is25% extra)
To get this extra credit you need to have a method to get theinput, one to perform the calculation, and one to output. Put yourpostfix calculation in a method called postfix. This method willaccept a string as parameter (the input string) and return aninteger. (either a primitive int or an Integer, your choice).
Rubric:
Comment to state what the program does
Comments within the body of the program
use of try/catch with input file
Correctly declare, initialize, and use a stack
Correct calculation
This criterion is linked to a Learning OutcomeNicely formedoutput
EXTRA CREDIT. 3 methods (input, postfix, output)