Equation Evaluator Project

Create a Program that will accept an equation as input from the user using standard algebraic format.

Examples:
N O N (ENTER)
(N O N) O N (ENTER)
( ( ( N  O N O N ) O N O ( N O N ) O N ) O N ) O N (ENTER)

where N is a number and O is either a math or logical comparison operator. The entire entry must be entered as a single input with one enter key click.

The Math operators that must be accepted are:
+ addition
– subtraction
* multiplication
/ division
% modulus

The comparison operators are:
== equals
!= not equals
@= absolute value of both are equal
< less than
<= less than or equals
> greater than
>= greater than or equals
NOTE: You are not required to include comparisons of equations. You may limit comparisons to just 2 numbers.

The use of math operators will cause the resulting number to be displayed.

The use of a comparison will cause “True” of “False” to be displayed.

Allow the user to repeat the inputting of expressions as many times as they would like. The program must not fail due to improper user input, so, you must catch error exceptions and handle them.

NOTE: I suggest that you use the algorithm in the attached Word document as your basic equation parsing algorithm. You must use two stacks, based on the Stack ADT, to parse the user inputted equation.

Include your algorithms, and other appropriate documentation in your code. Include UMLs for any  classes that you use to create objects.
—————————————————————————-
1. While there are still tokens to be read in,

  1.1 Get the next token.

  1.2 If the token is:

      1.2.1 A number: push it onto the value stack.

      1.2.2 A variable: get its value, and push onto the value stack.

      1.2.3 A left parenthesis: push it onto the operator stack.

      1.2.4 A right parenthesis:

        1 While the thing on top of the operator stack is not a

          left parenthesis,

            1 Pop the operator from the operator stack.

            2 Pop the value stack twice, getting two operands.

            3 Apply the operator to the operands, in the correct order.

            4 Push the result onto the value stack.

        2 Pop the left parenthesis from the operator stack, and discard it.

      1.2.5 An operator (call it thisOp):

        1 While the operator stack is not empty, and the top thing on the

          operator stack has the same or greater precedence as thisOp,

          1 Pop the operator from the operator stack.

          2 Pop the value stack twice, getting two operands.

          3 Apply the operator to the operands, in the correct order.

          4 Push the result onto the value stack.

        2 Push thisOp onto the operator stack.

2. While the operator stack is not empty,

    1 Pop the operator from the operator stack.

    2 Pop the value stack twice, getting two operands.

    3 Apply the operator to the operands, in the correct order.

    4 Push the result onto the value stack.

3. At this point the operator stack should be empty, and the value

  stack should have only one value in it, which is the final result.