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

Saint Louis University

Computer Science 150
Introduction to Object-Oriented Programming

Michael Goldwasser

Fall 2006

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: a`vF^`vFc``l-Fhp6#,$-F[yF\a`lF`p7%-F

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


Practice Problems


Problems to be Submitted (20 points)

  1. (5 points)

    Describe an initial design for a SodaMachine class

    1. Give three or more attributes for the class, describing the semantics, type and initial value for each.
    2. Give a list of seven or more supported behaviors. For each behavior indicate the types for the parameter(s) and return value(s) if applicable. Also explain whether each behavior changes the state information, and if so, in what manner.

  2. (5 points)

    In modeling the purchase of 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.

    Give a sequence diagram which represents a series of interactions which take place in the process of ordering and buying a sandwich. Your diagram should include at least six distinct interactions. For each, your diagram should clearly demonstrate

    See Figure 1.6 on page 21 for an example of a sequence diagram.

  3. (5 points)

    Exercise 1-21 on page 36.

    Consider the high-level design of two classes, BasicClock, representing a basic digital clock, and AlarmClock, representing a clock with an alarm.

    Describe the high-level design of both of these classes using inheritance to model an AlarmClock based upon a BasicClock. List the attributes and behaviors that you would include in each class.

  4. (5 points)

    Think of some objects you see everyday that form a hierarchy. You do not need to detail the precise members of each class, only the relationships among classes. Your hierarchy should have at least 3 levels and include 10 or more overall 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 2006
Last modified: Tuesday, 05 September 2006
Course Home | Homework | Lab Open Hours | Programming | Schedule & Lecture Notes | Submit | Turing Access