# Java program to parse an arithmetic expression

Write a Java program that takes as input an infix arithmetic expression then transforms it to a postfix expression and based on a binary tree, it evaluates that expression. For instance, the program takes the following infix expression: (1 + 2) * (3 - 4) / (1 + 2) then transforms it to a postfix expression: 1 2 + 3 4 - * 1 2 + / and then stores it in a binary tree. After that, your program should do the opposite: traverse the binary tree and print out the arithmetic expression in infix format.

© BrainMass Inc. brainmass.com October 10, 2019, 7:03 am ad1c9bdddfhttps://brainmass.com/computer-science/java/java-program-parse-arithmetic-expression-566292

#### Solution Summary

The solution shows how to parse an expression in Java.

$2.19