Question: Hey every I need help with a java project. If you can leave comments itll help a lot! thanks! Infix Postfix Consider the infix-postfix conversion
Hey every I need help with a java project. If you can leave comments itll help a lot! thanks!
Infix Postfix Consider the infix-postfix conversion algorithm given in your textbook (pages 174-176).
Implement the algorithm but do not assume the infix expressions are error free. For each infix expression (your program must handle any number of them) convert and display the correct postfix equivalent. If the infix expression is syntactically incorrect display a message which indicates the type of error. Your program must place the postfix expression into a queue and when conversion is complete display the queue. The algorithm in the book uses a String for the postfix expression, you must use a queue.
Operands are single character identifiers. Consider the binary operators of +,-, * and /, with normal operator precedence, parentheses are used to change normal precedence rules. Expressions may contain blanks (any number of them) as delimiters. Your error checking must be incorporated into the translation algorithm given in the book; it cannot be handled in a separate pre-translation pass of the expression. You should be able to recognize at least the following three errors: mismatched parentheses, missing operand, and missing operator. You are to use exceptions as the method of alerting of the error, and must raise a different exception for each of the three errors.
A sample run might be:
(a + b) * c -> a b + c *
(a + b * c ->mismatched parentheses
a + + b ->missing operand
a + -> missing operand
a b + -> missing operator 


throws symtaxE //Process each operatorsti Prek the har topop Postfix String nfis) indin LinedPATTERN) CVraatched epesing pal Except the top is empty Faye
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
