COM 1204 Object-Oriented Design - Summer 2001 - Assignments

Professor Futrelle -- College of Computer Science, Northeastern U., Boston, MA

Updated Saturday 8/10/2001


August 10th. Assignment #6: Basically, finish and test your implementation. Due by the end of Thursday, August 23rd.

-------------------------

August 4th. Assignment #5: All details are now posted for the second Network assignment, Assignment #5. Due by the end of Friday, August 10th.

July 21st. Assignment #4: All details are now posted for the first Network assignment, Assignment #4.

Important note about Assignment 3 that was emailed Tuesday morning, July 10th:

Some of the code that's being handed in misses the point. If an owner and dog are going to communicate, then a single Air instance has to be created. Then a reference to this Air object must be set up inside an owner object and also inside a dog object. Then the owner will have a "piece of air" into which to insert his/her message ("it" if the dog is owned by a unisex robot ;-). When the dog extracts (listens to) the message, it's getting the message from the same piece of air, the same Java instance of Air.

It might help you to define a fourth class, call Runnit or some such, that creates the three other objects, makes sure that the owner and dog each have a reference set up to the air object and then tells the owner to say something (which it says to the one and only air) and then tells the dog to listen in which case the dog listens to the same air and hears the message.

Hope this helps.

-- RPF

-------------------------

The assignments are briefly described here, but the details will be discussed in class. Further, the assignments finally worked out in class may differ in some details from the descriptions here. In line with our textbook, all member variables should be private in all your classes and most methods should be public. The printed output of your tests should be kept in a separate file or appended to the end of your class file in a large block comment. The test results must be commented to describe what they demonstrate.

Assignment #1. Due emailed Wednesday, June 27th by the beginning of class. Define a class SimpleDog with methods for setting and getting its name (a String). Also define a method bark() that will cause "Woof!" to be printed. Then create a main() that creates a SimpleDog and tests the methods you've written.

If for some reason you cannot get going on our Unix systems this soon to do the machine work and electronic handin, hand in a paper copy of the source code, including a few lines showing what commands you would use to compile and run the code and what output you'd expect to see. If you write the handin out by hand be sure it is very neat and legible!

Assignment #2. Due emailed by Tuesday midnight, July 3rd. This involves both subclassing and using specifications ala Chapter 3. Do the various portions of this assignment, step by step, in the order given, explaining your test results for each stage.

  1. Create a subclass of SimpleDog called TrickDog that has additional methods for sit() and lieDown(). They should print out how the dog reacts to the commands. Test them.


  2. Write out specifications for the two methods using the REQUIRES, MODIFIES, EFFECTS approach of Chapter 3 as part of the comments.


  3. Alter the printouts for the sit() and lieDown() methods so they are prefaced by the dog's name. Test them.


  4. Test these augmented methods by creating two dogs with different names and applying the methods to them.


  5. Create a constructor that allows you to give a dog a name at creation time. Redo your tests to show that this works.


Assignment #3. Due emailed Wednesday, July 11th by the beginning of class. This involves constructing two additional classes, and optionally still additional classes and functionality. The idea here is that when an owner "says" something the message is put in the "air" and the dog "hears" the command by retrieving the message from the air. The optional part will involve specifying a class for places, with could have instances such as yard or car. A dog can be moved between them, knows where it is and may react to that. At each stage below, test what you've done. Write out the specifications for all methods, as before.

  1. Create a further subclass of TrickDog called HearingDog. Also create a class Owner and a class Air.


  2. The Owner should have method say() that takes a String which the owner then inserts in the air.


  3. Air needs three methods, say() for inserting a string into it, listen() for the dog to retrieve the message, and clearTheAir() to empty the message after all dogs have had their chance to listen.


  4. The dog can be further subclassed to ListeningDog that can do all of the above but when its doStuff() method is run it listens and acts accordingly.


Assignment #3, Optional part, 5 points extra credit. This must be done carefully. You must not implement any of the method bodies below, only write the specifications for them. The directions are deliberately imprecise. You will have to firm them up.

  1. Assume you are to define a class Place, which could have instances such as house, yard, car and park.


  2. Write the specs for a static method transfer() of Place that will transfer a specified dog from one specified place to another.


  3. Specify additional functionality that would allow a dog to be told where it is, a method that would be called by transfer().


  4. Specify that a dog's bark would be altered by knowledge of its location.


  5. For the full extra credit you must create Javadoc pages from your specifications.


Assignment #4, Preview. We will be modeling a simple version of Ethernet, with systems interchanging targeted messages with both interference and noise possible. Class design, specifications, tests, javadoc and implementation will all be involved.


Go to COM1204 home page

Return to Prof. Futrelle's home page