Question
I need help with this program please thank you lmk what else you need. Infix & Postfix Notations You will need to design, implement, and
I need help with this program please thank you lmk what else you need.
Infix & Postfix Notations
You will need to design, implement, and test a utility class, Notation, to support -
- Infix to postfix conversion (of an expression)
- Postfix to infix conversion
- Postfix evaluation
Infix notation is the notation commonly used in arithmetical and logical formulae and statements. It is characterized by the placement of operators between operands "infixed operators" such as the plus sign in "2 + 2".
Postfix notation is a notation for writing arithmetic expressions in which the operands appear before their operators. There are no precedence rules to learn, and parentheses are never needed.
Specifications
Data Element
- String
Data Structure
- NotationQueue, a generic queue, implements the provided QueueInterface
- The Queue must be an array-based implementation, implemented from scratch
- NotationStack, a generic stack, implements the provided StackInterface
- The Stack must be an array-base implementation, implemented from scratch
- You may include (implement) additional (private) methods to these classes as needed
- DO NOT utilize any java.util classes (e.g., ArrayList, Queue, Stack or Hashmap) for these classes
Utility Class
- The Notation (utility) class includes the following methods
- convertInfixToPostfix Convert infix notation to postfix notation. It will take in a string and return a string
- A queue MUST BE used (as the internal structure) to hold the postfix solution. Then use the toString method of the Queue to return the solution as a string.
- convertPostfixToInfix Convert postfix notation to infix notation. It will take in a string and return a string
- evaluatePostfixExpression Evaluate the postfix expression. It will take in a string and return a double
- Review the Notation.html (included) to learn more about these methods
- convertInfixToPostfix Convert infix notation to postfix notation. It will take in a string and return a string
For simplicity sake:
- Operands will be single digit numbers
- Supported arithmetic operations include:
- Addition (+)
- Subtraction (-)
- Multiplication (*)
- Division (/)
- Modulus (%)
Exception Classes
- Implement the following user defined exception classes:
- InvalidNotationFormatException occurs when a Notation format is incorrect.
- StackOverflowException occurs when a push method is called on a full stack.
- StackUnderflowException occurs when a top or pop method is called on an empty stack.
- QueueOverflowException occurs when an enqueue method is called on a full queue.
- QueueUnderflowException occurs when a dequeue method is called on an empty queue.
GUI Driver (Provided)
- Initially neither radio button for notation is selected. When a radio button is selected, the Convert button is enabled and the appropriate label and field are visible for the user input.
- When the user selects the Convert button, the appropriate label and field with the conversion will be displayed.
- When the user selects the Evaluate button, the answer to the expression will be displayed.
- When the Exit button is selected, the application will close
- UI should work as-is, no changes should be required. Consult instructor if needed
Algorithms
- Review provided Video Notes to learn more about
- Infix to postfix conversion
- Postfix to infix conversion
- Postfix evaluation
Programming Concepts
- Generic Queue
- Generic Stack
- Infix and Postfix conversions
- Postfix evaluations
- Exception handling
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started