Question: programming project involves designing, writing and testing a program that accepts an arithmetic expression of unsigned integers in postfix notation in which the tokens are

programming project involves designing, writing and testing a program that accepts an arithmetic expression of unsigned integers in postfix notation in which the tokens are separated by spaces and builds and processes the arithmetic expression tree that represents that expression The main class will be P2GUI. It should create a Swing based GUI shown below: Three Adddress Generator Enter Postfix Expression 359+ 23* Construct Tree Infix Expression((3-(5+9))/ (2 3)) The GUI must be generated by code that you write. You may not use a drag-and-drop GUI generator Pressing the Construct Tree button should cause the following: (i) the arithmetic expression tree that represents the entered postfix expression will be constructed, (i) using that tree, the corresponding fully parenthesized infix expression should be generated and displayed in the GUI and finally (ii) a file should be generated that contains the 3-address format instructions corresponding to the arithmetic expression and, as the last line in the file, the total number of nodes in the tree. The total number of tree nodes will be calculated by using a recursive method. Note. These topics, including relevant classes for implementing and processing an expression tree, are discussed in the week 4 reading "Binary Trees, Expression Trees, BST (AVL) trees, and B-Trees" section I "Expression Trees" X The above example should produce the following output file containing the 3-address instructions: Add RO 5 9 Sub R1 3 RO Mul R2 2 3 Div R3 R1 R2 Total nodes in the tree: 9 It is not necessary to reuse registers within an expression as shown in the above mentioned reading and you can assume there are as many available registers as needed. Each new expression should, however, begin using registers starting at RO You may assume that the expression is syntactically correct with regard to the order of operators and operands, but you should check for invalid tokens, such as characters that are not valid operators or operands such as 2a, which are not valid integers. If an invalid token is detected, a checked custom exception InvalidTokenException should be thrown and caught by the main class and an appropriate error message should be displayed in a JOptionPane. Below is an example Three Adddress Generator Enter Postfix Expression 23& Construct Tree Infix Expression Message X Invalid token & The Google recommended Java style guidel used to format and document your code. Specifically, the following style guide attributes should be addressed: header comments include filename, author, date and brief purpose of the program; In-line comments used to describe major functionality of the code; the meaning and the role of variables and constants are indicated as code comments; meaningful variable names and prompts applied; class names are written in UpperCamelCase; variable names are written in lowerCamelCase; constant names are in written in All Capitals; braces use K&R style. should be n addition the following design constraints should be followed: declare all instance variables private; avoid the duplication of code. Submit the following to the Project 2 assignment area no later than the due date listed in your LEO classroom 1. All java source files (no other file types should be submitted) and the output file generated by the program. The source code should use Java code conventions and appropriate code layout (white space management and indents) and comments. All submitted files may be included in a .zip file. 2. The solution description document P2Solution Description (.pdf or .doc/ .docx) containing the following: (1) Assumptions, main design decisions, error handling; (2) A UML class diagram that includes all classes you wrote. Do not include predefined classes. You need only include the class name for each individual class, not the variables or methods; (3) A table of test cases including the test cases that you have created to test the program. The table should have 5 columns indicating (i) what aspect is tested, (i) the input values, (ii) the expected output, (iv) the actual output and (v) if the test case passed or failed. Each test case will be defined in a table row. (4) Relevant screenshots of program execution; (5) Lessons learned from the project;

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Programming Questions!