CS 117: Introduction to Computer Science
Assignment 1: Object-Oriented Thinking

Assigned on Monday, 1/7/02.
Due on Wednesday, 1/9/02, on paper, in the grader's mailbox, by 5 PM.

Plese turn in your answers to the following tasks on paper.

1. Suppose that you wish to model doing laundry. After all, laundry needs all the excitement it can get! Give a name and a short description (approx. 1 sentence) for at least four classes that would be useful. Choose one of these classes, and provide more detail. Draw a class/object diagram for it that contains both data values and methods. Describe briefly each data value and method (approx. 1 sentence), and make sure that in the diagram and description you make it clear which ones are class members and which ones are instance members. Make sure to include at least one class data value, one class method, one object data value, and one object method. In the diagram, instantiate at least two objects from the class.

2. Show an class/object model for your favorite book, TV show, or movie. Think carefully about what general concepts constitute classes, and what specific examples correspond to objects. For example, you might have a class of people and objects that represent specific characters in the book. Include an example of inheritance. Here's part of my example, without the diagram (though you should draw the diagram for your assignment):

Superclass: CharactersInHolyGrail
||
||
\/
Subclass: KnightsWhoSayThings
Instance data values: favoritePhrase
|        |
|        |
|        \/
|        Object: knightWhoSaysNi
|        favoritePhrase: "Ni!"
\/
Object: knightWhoSaysComplicatedExpression
favoritePhrase: Ekky-ekky-ekky-ekky-z'Bang, zoom-Boing, z'nourrrwringmm