Question: Please make sure the main method and the output same as given. Please make sure it works. /////////////////////////////////// Write a program that transforms a postfix
Please make sure the main method and the output same as given. Please make sure it works.
///////////////////////////////////
Write a program that transforms a postfix expression into a tree such as that shown in Figure 8.11 in this chapter. Youll need to modify the Tree class from the tree.java program (Listing 8.1) and the ParsePost class from the postfix.java program (Listing 4.8) in Chapter 4. There are more details in the discussion of Figure 8.11.
After the tree is generated, traversals of the tree will yield the prefix, infix, and postfix equivalents of the algebraic expression. The infix version will need parentheses to avoid generating ambiguous expressions. In the inOrder() method, display an opening parenthesis before the first recursive call and a closing parenthesis after the second recursive call.
-------------------------------------------
Please make sure in this JAVA program the main method is same as given. Please don't repost any answer that's already given in chegg. Thanks


/* You need to write classes Node, Tree, ParsePost, and PostTreeApp with main method */ public static void main(String] args) throws IOException ParsePost pp; = null while(true) System.out.print("enter, show, or traverse: "); int choice = getchar(); switch(choice) case 'e System.out.print("Enter a postfix expression (AB+): "); String str getString); pp = new ParsePost(str); theTree-pp.doParse); break; case 's' theTree.displaTree); break; case 't: System.out.print("Enter type 1, 2 or 3: "); int value = getInt(); theTree.traverse(value); break default System.out.print("Invalid entry "); end switch )..-// end while ,// end main() Your output may look like enter, show, or traverse: e Enter a postfix expression (AB+): ABC+* enter, show, or traverse: s
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
