The George Washington University
School of Engineering and Applied Science
Department of Electrical Engineering and Computer Science

CSci 131 -- Data Structures
Project #3

Due Date: October 20, 1998

The purpose of this project is to give you some more practice in dealing with generic packages, and illustrate the advantages of a clearly-specified generic interface in supporting multiple implementations and multiple clients. This project uses material mostly from Chaps. 5 and 6. If you do the first part of the project this week, it will definitely help you prepare for the midterm next Tuesday.

You are hired by the railroad company to develop a new computer system for keeping track of passenger cars (carriages). Here is the information to be contained in a railway car record:

A car can be

  • a coach (a car with seats for passengers, like a bus or airliner), for which we need to know the number of seats (up to 84)
  • a sleeper (a car with little rooms containing beds for overnight travel), for which we need to know the number of beds (up to 36)
  • a dining car (a car with a kitchen and restaurant tables for meals), for which we need to know the number of tables (up to 20) and whether the kitchen uses oil or electricity to fuel the ovens
  • a baggage car (a car with one big open space used to carry suitcases and other passenger baggage), for which we need to know the storage capacity, in cubic meters (up to 250).

Each car has a unique number (up to 4 digits). Each sleeper also has a name (typically a place name like Yellowstone Park), up to 20 letters. The other types of cars do not have names.

Each car has a certain weight (in kilos).

For each car we need to know its purchase date and purchase price

The car record will be a variant record; the car data base will be an instance of Tables_Generic.

You have two main subtasks in this project:

  1. Develop the base package for Trains, using Employees as an example to follow. Also develop an input/output child package, Trains.IO, by analogy to Employees.IO. Test these in a sensible way, using othr test programs as examples.
  2. Develop and test a user interface similar to Employee_UI. You can start with a copy of Employee_UI and just make changes to it.

If you completed Project 2, you should be able to use your Tables_Generic package without a single change.