## Description

**Infix to Postfix expression Java Program**

Write a java program that converts an infix expression into an equivalent postfix expression.

The rules to covert an infix expression to postfix expression are:

Scan the expression from left to right in only one pass.

If the next symbol is an operand, append it to the postfix expression.

If the next symbol is a ‘(‘, push it onto the stack.

If the next symbol is a ‘)’, pop and append all the symbols from the stack until the first ‘(‘ is found. Discard the ‘(‘

If the next symbol is an operator:

a. Pop and append to the postfix expression every operator from the stack that is above the most recently scanned ‘(‘ and that has precedence greater than or equal to the new operator.

b. Push the new operator onto the stack.

After the infix expression is completely processed, pop and append to the postfix string everything from the stack.

In this program, you are to consider the following arithmetic operators: +, -, * and /. You may assume that the expressions you process are error free.

Please check your program using the following:

1. A + B – C

2. (A + B) / (C – D)

3. A + ( (B + C) * ( E – F ) – G ) / (H – I )

Hand in a hard copy of your source code. You may append your testing as part of your documentation.

## Reviews

There are no reviews yet.