## 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.