Write a program called PostfixToInfix.java to solve the following problem....solved

Write a program called PostfixToInfix.java to solve the following problem....solved

Write a program called PostfixToInfix.java to solve the following problem.

 

Write a program to read in a postfix expression and output a corresponding infix expression. You may use any architecture and machinery developed and explained in class at length, as well as code from your solution to the last lab. Your output expression may have as many parethentheses as you decide are necessary for its unambigous evaluation without assuming anything about operator precedence. A postfix expression is defined as in the last lab, and all other details are defined as in class. Error messages for nonsense postfix expressions should be produced as defined in the last lab. You may not use any classes supplied with Java apart from those used in teaching this class. Your program should have behavior as illustrated by the following instance.

 

java PostfixToInfix

1 2 3 + *

1*(2+3)

 

SubmitPostfixToInfix.javato moodle as your solution.
Powered by