ComputerScienceExpert

(11)

$18/per page/

About ComputerScienceExpert

Levels Tought:
Elementary,Middle School,High School,College,University,PHD

Expertise:
Applied Sciences,Calculus See all
Applied Sciences,Calculus,Chemistry,Computer Science,Environmental science,Information Systems,Science Hide all
Teaching Since: Apr 2017
Last Sign in: 103 Weeks Ago, 3 Days Ago
Questions Answered: 4870
Tutorials Posted: 4863

Education

  • MBA IT, Mater in Science and Technology
    Devry
    Jul-1996 - Jul-2000

Experience

  • Professor
    Devry University
    Mar-2010 - Oct-2016

Category > Programming Posted 04 May 2017 My Price 11.00

CMSC 350 Project 2

Hello, can you please help me.  I need the .java files in a zip file with the documentation in a word document. Thanks in advance!

 

 

CMSC 350 Project 2
The second programming project involves writing a program that accepts an arithmetic
expression of unsigned integers in postfix notation and builds the arithmetic expression tree that
represents that expression. From that tree, the corresponding fully parenthesized infix expression
should be displayed and a file should be generated that contains the three address format
instructions. This topic is discussed in the week 4 reading in module 2, section II-B. The main
class should create the GUI shown below: 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 tree to be constructed and using that tree, the
corresponding infix expression should be displayed and the three address instruction file should
be generated.
The postfix expression input should not be required to have spaces between every token. Note in
the above example that 9+- are not separated by spaces.
The above example should produce the following output file containing the three address
instructions:
Add
Sub
Mul
Div R0
R1
R2
R3 5 9
3 R0
2 3
R1 R2 It is not necessary to reuse registers within an expression as shown in module 2, section II-B, and
you can assume there are as many available as needed. Each new expression should, however,
begin using registers starting at R0.
Inheritance should be used to define the arithmetic expression tree. At a minimum, it should
involve three classes: an abstract class for the tree nodes and two derived classes, one for
operand nodes and another for operator nodes. Other classes should be included as needed to
accomplish good object-oriented design. All instance data must be declared as private.
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
1 RuntimeException should be thrown and caught by the main class and an appropriate error
message should be displayed. Below is an example: You are to submit two files.
1. The first is a .zip file that contains all the source code for the project, which includes
any code that was provided. The .zip file should contain only source code and nothing
else, which means only the .java files. If you elect to use a package the .java files
should be in a folder whose name is the package name.
2. The second is a Word document (PDF or RTF is also acceptable) that contains the
documentation for the project, which should include the following:
a. 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
b. A test plan that includes test cases that you have created indicating what aspects
of the program each one is testing
c. A short paragraph on lessons learned from the project 2 Grading Rubric:
Criteria Design Functionality Test Cases Documentation Overall Score Meets
5 points
GUI is hand coded and matches
required design (1)
Inheritance hierrachy with at least
3 classes is used (2)
Other classes are used to support
good object-oriented design (1)
All instance data is private (1)
10 points
Produces correct fully
parenthesized infix expressions for
all input (3) Does Not Meet
0 points
GUI is generated by a GUI generator or
does not match required design (0)
Inheritance hierrachy not used or has less
than 3 classes (0)
Does not use other classes to support
good object-oriented design (0)
Some instance data is not private (0)
0 points
Does not produce correct fully
parenthesized infix expressions for some
input (0) Produces correct three address
file for all input (3)
Correctly parses expressions
without space delimiters (2)
Registers restart at R0 on each
new expression (1)
Detects invalid tokens (1)
5 points
All operators included in test cases
(2)
Test cases include expressions
without spaces (1)
Test cases include a case to test
invalid token beginning with a
digit (1)
Test cases include a case to test
invalid operators (1)
5 points
Correct UML diagram included (2)
Lessons learned included (2)
Comment blocks with class
description included with each
class (1)
Meets
16 or more Does not produce correct three address
file for some input (0)
Does not correctly parse expressions
without space delimiters (0)
Registers do not restart at R0 on each
new expression (0)
Does not detect invalid tokens (0)
0 points
Some operators not included in test cases
(0)
Test cases don't include expressions
without spaces (0)
Test cases do not include a case to test
invalid token beginning with a digit (0)
Test cases do not include a case to test
invalid operators (0)
0 points


Correct UML diagram not included (0)
Lessons learned not included (0)
Comment blocks with class description
not included with each class (0)
Does not meet
0-15 3

Project2 For solving the second project, you need first to decompose the problem into smaller tasks and
next, identify how each task is solved. For doing so, you need to get the appropriate sequence of
steps (that is, specific operation on specific data structure) to follow with your input data to build
the correct tree, and next to use that tree to create the infix expression and the output sequence.
General information:
There are 5 types of operations performed on any kind of data structure:
- insert in the structure/ with the particular case of build the structure (which is not necessary
done via insertions)
- delete from the structure
- update in the structure
- search in the structure
- traverse the structure.
Now, for the traversal, there are several strategies, depending on the structure.
Forward/backward if it comes to arrays and lists (from head to tail/tail to head respectively).
Preorder, inorder and postorder for the trees (if the tree is Left Node Right, the traversals are:
preorder = Node Left Right
inorder = Left Node Right
postorder = Left Right Node.
The tasks of problem are:
1. Task1: building the binary tree from the input array containing the postfix expression (so, the
Construct Tree mentioned in the requirements is a build tree operation); HINT: to have a good
image of the problem, draw (pencil and paper) the tree from the expression in the example; if not
enough, draw several other trees; once you have the view of an actual tree, you should properly
identify how to build it (hint in the hint: what’s the content of the root? Where from can you get
that information? What’s the left sub-tree? The right one?);
2. Task2: build the infix expression (so, it would be another array created out of a tree; that tree
needs traversed; which order, this is the aspect you should identify (shouldn’t be difficult));
3. Task3: from the expression built in the previous step, generate the 3 address instructions
sequence. HINT: to do so, the approach in the first project should help; it's just that instead of
evaluating each subexpression, you should write in a file the appropriate sequence.

Attachments:

Answers

(11)
Status NEW Posted 04 May 2017 02:05 AM My Price 11.00

-----------

Attachments

file 1493865386-Solutions file 2.docx preview (51 words )
H-----------ell-----------o S-----------ir/-----------Mad-----------am ----------- Th-----------ank----------- yo-----------u f-----------or -----------you-----------r i-----------nte-----------res-----------t a-----------nd -----------buy-----------ing----------- my----------- po-----------ste-----------d s-----------olu-----------tio-----------n. -----------Ple-----------ase----------- pi-----------ng -----------me -----------on -----------cha-----------t I----------- am----------- on-----------lin-----------e o-----------r i-----------nbo-----------x m-----------e a----------- me-----------ssa-----------ge -----------I w-----------ill----------- be----------- qu-----------ick-----------ly -----------onl-----------ine----------- an-----------d g-----------ive----------- yo-----------u e-----------xac-----------t f-----------ile----------- an-----------d t-----------he -----------sam-----------e f-----------ile----------- is----------- al-----------so -----------sen-----------t t-----------o y-----------our----------- em-----------ail----------- th-----------at -----------is -----------reg-----------ist-----------ere-----------d o-----------n -----------THI-----------S W-----------EBS-----------ITE-----------. ----------- Th-----------ank----------- yo-----------u -----------
Not Rated(0)