Data
Structures and Algorithms IThis program will read a series of arithmetic expressions in infix notation. Each expression will be evaluated and the result displayed. The main Java technology used will be String and List operations. The algorithim used will reflect the normal brute force approach humans apply to this task.
All data and operations will be confined of the set of Integers. The operation *, /, %, +, and - are the only ones recognized, with the usual precedence rules. Parentheses will be allowed as well. All input will be assumed to be legal, so no error checking needs to be done.
Each line of the input file (named infix.txt) will contain an expression that is to be echoed to the console. Your program then must evaluate the expression and then add an equals sign and the arithmetic result to the output. Each line of input will correspond to one line of output. Stop the program when there are no lines remaining in the input stream.
You must implement and utilize the following classes.
TokenType
This is an enumerated type definition for the type of a token. Place this in its own file. Provide for the following values: NUMBER, OPERATION, L_PAREN, R_PAREN, and ILLEGAL. You should not need to use ILLEGAL since all of the data will be valid, but you should provide for this just in case.
Token
There are 2 constructors. The first accepts a single character (char) representing a parenthesis or operation. The second accepts a String object representing an Integer. The Token objects must store the argument to the constructor and be able to report the following:
InfixEvaluator
The constructor accepts a String representing an infix expression. This must be stored as given and converted to a list of Tokens. There is a private method that will help accomplish this second part of the initialization task.
The class must implement the following public methods:
There are also several private methods:
Be sure to document every class and method (including the class supplied for you). Include a printed UML diagram for this project. Don't forget to check the documentation standards and include the signed cover sheet with your printed submission. Follow submission instructions on the assignment page.