Reference no: EM132248971
Data Structures
1. a generic queue class called MyQueue. MyQueue will implement the QueueInterface given you. You will be creating MyQueue from scratch (do not use an internal object of the Queue class from java.util)
2. a generic stack class called MyStack. MyStack will implement the Stack Interface given you. You will be creating MyStack from scratch (do not use an internal object of the Stack class from java.util)
Utility Class
The Notation class will have a method infixToPostfix to convert infix notation to postfix notation that will take in a string and return a string, a method postfixToInfix to convert postfix notation to infix notation that will take in a string and return a string, and a method to evaluatePostfix to evaluate the postfix expression. It will take in a string and return a double. A method to evaluateInfix to evaluate the infix expression. It will take in a string and return a double. Follow the Javadoc provided for you.
In the infixToPostfix method, you MUST use a queue for the internal structure that holds the postfix solution. Then use the toString method of the Queue to return the solution as a string (this will differ slightly from the algorithm in your book).
For simplicity sake:
a. operands will be single digit numbers
b. the following arithmetic operations will be allowed in an expression:
+ addition
- subtraction
* multiplication
/ division
Exception Classes
Provide the following exception classes:
1. InvalidNotationFormat - occurs when a Notation format is incorrect
2. StackOverflowException - occurs when a top or pop method is called on an empty stack.
3. StackUnderflowException - occurs when a push method is called on a full stack.
4. QueueOverflowException - occurs when a dequeue method is called on an empty queue.
5. QueueUnderflowException - occurs when a enqueue method is called on a full queue.