Description
Problem Description
In the previous assignment, you wrote a Java program that prompted the user for an infix
expression and converted the result to postfix, displaying the result in the console window.
In this assignment, instead of simply displaying the postfix, you will implement a simple
interpreter that evaluates the expression, and returns an ordered sequence on one and two
operand expressions that can subsequently be evaluated by a simple processor. The point of this
assignment is to understand the Stack Interpreter outlined in the Appendix of Assignment 3.
Consider the following example: a+c*y-d*x
The corresponding Postfix expression is: a c y * + d x * –
Following the convention of Assignment 3, the expression would be evaluated as follows:
Token Stack
a a
c a c
y a c y
* a <c*y>
+ >
d > d
x > d x
* > <d*x>
– > – <d*x>
Method
Operator 1 = c
Operator 2 = y
Operand = *
Eval1 = <c*y>
Notes:
4. There are no bonus marks awarded for this assignment.
Max grade on this assignment: 100/100.


