write a program that takes as input an infix expression and outputs the equivaql
ID: 3535603 • Letter: W
Question
write a program that takes as input an infix expression and
outputs the equivaqlent post fix expression.
here are the details..
1) Ask the user to input an arithmetic expression in infix
notation. The
expression may contain integers, operators, parenthesis and
variables.
There should be a space between each item in your input
expression.
2) Convert the expression to postfix notation,
You are required to use at least one
stack
to create the expression
3) Your input expression should contain only positive
integers
4) If the expression entered is not well formed, your program
should
issue an error message telling the user that their input is in
error, and
ask for another expression to evaluate (flush your stack!)
5) Write your code to use a loop that allows the user to enter
moreÂ
expressions until they indicate that they are finished.
6) Extra Credit: using no variables in your input expression,
only
integers and operators,†¦create the
corresponding postfix expression,
print it, and then correctly evaluate the postfix
expression.
Explanation / Answer
You can refer to following site : http://electrofriends.com/source-codes/software-programs/java/advanced-programs/java-program-that-converts-infix-expression-into-postfix-form/
Related Questions
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.