Assignment 1 Solution

Part A: Quote Of the Day

Class Diagram

(click on a class to see details)

Documentation (javadoc output)

This application prints a random quote each time it is run (the functional requirement). The internal architecture is intended to be extensible and reusable, in the sense that each likely requirements change will impact at most one class.

The QuoteSource class has one responsibility -- to select and return a Quote object when requested. This hides the following design decisions:

The responsibility of the Quote class is to contain a single quotation, and to create a string representation when requested. This hides the internal data of a quotation (which might in the future have additional fields like author, date, or type).

The QuoteOfTheDay class takes care of I/O.

Part B: Hospital Information System

Informal Description

"The system is a hospital information system. A hospital has doctors and patients. Each patient is assigned to one doctor, but a doctor can have any number of patients. Patients check in to the hospital and assigned a doctor if they don't already have one. While in the hospital, doctors record various observations about each patient at various times. Examples of observations are blood pressure and temperature. The hospital keeps track of all the observations for a given patient until they check out of the hospital."

Scenario

  1. Patient checks in to hospital.
  2. Hospital assigns doctor to the patient.
  3. The doctor records a blood pressure measurement for the patient.
  4. The doctor records a temperature for the patient.
  5. The doctor prescribes medicine for the patient's condition.
  6. The patient checks out of the hospital.

System Diagram

Class Diagram