pa05 : Expression Trees
num | ready? | description | assigned | due |
---|---|---|---|---|
pa05 | true | Expression Trees | Tue 05/30 09:00AM | Thu 06/08 11:59PM |
PA5 can be done either in two-people teams or individually.
Create a new git repo following the correct naming convention. Add your partner as a collaborator and join the same group on submit.cs. Clone your git repo to your cs24 directory on CSIL. Be sure to push intermediate versions of your code to github after you complete EVERY function in this assignment.
Get the starter code by doing a git pull in the starter-code repo and then copying over to your git repo directory. You must have the files express.h
and expresstest.cpp
- Implement class ExpressionTree as it is defined in express.h. Your implementation must be in a new file that you create named express.cpp.
-
This is a variation of Programming Project 1, pp. 534-535 of the textbook. Read the instructions (and hints) presented there. This variation adds three print methods to the problem presented in the text.
-
Implement each of the member functions (including both constructors, the destructor and the assignment operator) of class ExpressionTest.
-
Be sure to #include “express.h” and remember to type your name(s) and the date in the comment at the start.
-
The print functions must show the expression parts (numbers and operators and parentheses) separated by one space from each other, and there must be one blank space at the end of each printed expression. Print to cout.
-
Function printPre must print the expression in prefix notation, and printPost must print it in postfix notation. Function printIn must print parentheses surrounding each addition operation, but multiplication operations must not be parenthesized, and of course this function must print the expression in infix notation.
-
Compile and test your programs at CSIL. You may use expresstest.cpp for that purpose. The program will run one of nine tests, and here are sample results from our solution, showing each of the nine tests being run.
-
Submit express.cpp for project PA5 at https://submit.cs.ucsb.edu/, or use the following command from a CS terminal:
~submit/submit -p 753 express.cpp
Be sure to wait for the results of all nine tests. If you score 100/100 and you’ve followed all of the other rules, then you’ll earn full credit.
Special thanks to C. Michael Costanzo and Michael Main, University of Colorado, creator of many parts of this project.