Question: Write a program that converts an infix expression into an equivalent postfix expression using Algorithm discussed in class. In this program, you will consider the
Write a program that converts an infix expression into an equivalent postfix expression using Algorithm discussed in class. In this program, you will consider the following (binary) arithmetic operators: +, -, *, and /. You may assume that the expressions you will process are error free. Design a class that stores the infix and postfix strings. The class must include the following operations:
1. getInfixStores the infix expression
2. showInfixOutputs the infix expression
3. showPostfixOutputs the postfix expression Test your program on the following five expressions:
a) A + B - C;
b) (A + B ) * C;
c) (A + B) * (C - D);
d) A + ((B + C) * (E - F) - G) / (H - I);
e) A + B * (C + D ) - E / F * G + H;
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
