Course Home | Homework | Lab Hours | Programming | Schedule & Lecture Notes | Submit

Saint Louis University

Computer Science 150
Introduction to Computer Science

Michael Goldwasser

Fall 2005

Dept. of Math & Computer Science

Homework Assignment 01

Object-Oriented Design

Contents:


Overview

Topic: Object-Oriented Design
Related Reading: Ch. 1 of Goldwasser/Letscher supplement
Due: 1:10pm, Wednesday 7 September 2005

Please make sure you adhere to the policies on academic integrity.


Problems to be Submitted (20 points)

  1. (4 points)

    Write down the steps for an algorithm for a common everyday task. (The algorithm should have at least 7-10 steps.)

  2. (4 points)

    Consider the design of a Calculator representing a basic calculator.

    1. Give a list of attributes for the class (at least 3).
    2. List possible behaviors for the class (at least 7).
    3. For each behavior indicate the types for the parameter(s) and return value(s) if applicable.
    4. Indicate how each behavior changes the state information.

  3. (4 points)

    Consider the design of a Television representing a typical television.

    1. Give a list of attributes for the class (at least 3).
    2. List possible behaviors for the class (at least 7).
    3. For each behavior indicate the types for the parameter(s) and return value(s) if applicable.
    4. Indicate how each behavior changes the state information.

  4. (4 points)

    In modeling buying a sandwich at Au Bon Pain in the Busch Student Center we might use three classes: Cashier, Customer and SandwichMaker. There are a variety of interactions that occur between objects in this model. Each of these interactions should involve a pair of objects, with one being the initiator of the interaction. There also may be additional information sent in one direction or another as part of that interaction.

    Please describe a sequence of such interactions that takes place in the process of ordering and buying a sandwich (include at least six distinct interactions). For each of these interactions, describe clearly

  5. (4 points)

    Think of some objects you see everyday that form a hierarchy. Diagram this hierarchy, indicating what attributes or behaviors a class has that are not inherited from a parent class. (The hierarchy should have at least 3 levels and 10 classes.)


Extra Credit

  1. (2 points)

    The Au Bon Pain problem above was a real-world scenario which involved the interaction between two or more objects.

    Model some other real-world scenario, describing your model in similar fashion as with that earlier problem.
    (please pick a scenario that does not involve the purchase of something)


Michael Goldwasser
CSCI 150, Fall 2005
Last modified: Wednesday, 31 August 2005
Course Home | Homework | Lab Hours | Programming | Schedule & Lecture Notes | Submit