Question: I am trying to write a program that writes an RPN equation and calculates the problem in Java. I am not allowed to use import.java.util.Stack.

I am trying to write a program that writes an RPN equation and calculates the problem in Java. I am not allowed to use import.java.util.Stack. I need to write a replaceAll and Split method.  I am trying to write a program that writes an RPN
equation and calculates the problem in Java. I am not allowed to

You are to write a program that allows the user to type in a mathematical formula at the keyboard and produces the answer on the screen. The formula will be typed in INFIX notation and will include only positive integers for the numbers. The operators that are acceptable are the following: + (plus), - (minus), (multiply),/ (divide), and (power). Parenthesis are also allowed. You should allow the user to type in the equation of his/her choice and then display the answer on the screen. Display a real answer. (for example: 3/2-1.5, NOT 1) ALSO DISPLAY THE POST-FIX EQUATION ON THE SCREEN The normal rules of mathematics apply (parenthesis have the highest precedence followed by theA, followed by * and /, followed by - and +). Do not allow the program to bomb and warn the user if the equation is wrong. For example: 2+43/*12 cannot be calculated because there are too many operators. When I test the program, I will only type positive integers as input and I will type correct operations. Hints: You should treat the equation as a queue of tokens and read the tokens from the queue one at a time. Convert the INFIX equation to a POSTFIX equation. Then resolve the POSTFIX equation. Sample equations 12 + (2 4 /5 43 3 4 2 34 9 2 4+34 3 Postfix 12 2 4 5+ 43 3 4 2 34 +9 - 2 4 34 +3- Example of program running: Enter an equation: 12+ (6-4 Answer: 14 (1+1) / 2

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!