Saint Louis University |
Computer Science 146
|
Dept. of Math & Computer Science |
Topic: The Environment class
Due:
11:59pm Sunday, October 6
Related Reading: Pages 29 through top of 36 in case study
Please make sure you adhere to the policies on academic integrity.
You are to go through pages 29-36 of the case study, answering most exercises, and performing all interactive experiments described. Specifically, you are to provide responses to:
"Stop and consider" on page 32.
In the prose at the middle of page 33, they lament that the Position class does not define the != operator, and therefore that they must use the syntax:
if (! (oldLoc == newLoc) )from within the implementation of the Environment::Update method.
(As an aside, I'll note that my version of the update method is a bit more advanced then the one which was originally provided in the AP Case Study, so the code you see in print will not look exactly like the electronic version. The above if statement should appear at line 132 of our version.)
Change the update method to use the preferred syntax
if (oldLoc != newLoc)and attempt to remake the project. What error message is reported?
Make modifications to the Position class so that the new syntax is properly supported. Hint: You will need to provide the operator!= method, using an approach similar to the existing operator== method.
"Stop and help" on page 35. You do not need to implement any such changes; just describe at a high-level how you might do so.
Exercises 1 and 2 at the top of page 36.
Your assignment should be submitted electronically (details on the submission process). This should include your summary prose document, as well as any modified versions of source code. (In this case, position.h and position.cpp)