Question: Can you help me with this? public static String convertToPostfix(String infixExp) The convertToPostfix method converts the infix expression (the parameter string for this method) into
Can you help me with this?
public static String convertToPostfix(String infixExp) The convertToPostfix method converts the infix expression (the parameter string for this method) into a postfix expression. 1. If all parentheses are matching in the input infix expression string, then computes its postfix expression, and the method should return the string as: The Postfix Expression is: ABC++DHTY++R-*" Here, ABC++DHTY+R-*- is an example of postfix expression and the correct one for each input should be displayed instead of it. 2. If there is an open parenthesis that does not have its corresponding close parenthesis, then for the first such character, return a string with the message as: There is no matching close parenthesis." For instance,if the input infix expression string is: then for the first open parenthesis, there is no corresponding close parenthesis. In this case, the above message should be returned instead of any post fix expressin 3. If there is a close parenthesis that does not have its corresponding open parenthesis, then for the first such character, return a string with the message as: There is no matching open parenthesis. For instance, if the input infix expression string is: then for the first close parenthesis, there is no corresponding open parenthesis. In this case, the above message should be returned instead of any post fix expression
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
