CSPP 51090 & CMSC 22001: Software Construction Assignment 2

Due: April 13, 2004

Your task is to modify a Java program or a Scheme program that comes without any comments and without any automated tests. The purpose of the program is to find a path in Boston's subway system from one point to another. A passenger can choose two stations from two menus, and the program explains how to get from the first to the second via a list of subway stations.

To run the Java program, compile all files and launch the main function in class Main. To run the Scheme program, click Execute in DrScheme in the file main.scm. Be sure your language is set to the (module ...) language.

The goal of the first major modification is to improve the result window. The given program lists the subway stations without any indication where passengers have to switch from one subway line to another or to which subway line a given station belongs. The modified program should textually annotate each station in the result menu with its subway line(s). If a station belongs to two lines, the annotation should say so. [5pts]

A fancy modification should paint the background of each station name with a matching color. [1pt] (This is not required for the Scheme version.)

You may not modify any string constants to implement this modification.


The goal of the second major modification is to improve the algorithm for finding a route through the system. You may have noticed in playing with the program that it recommends far more switches than necessary. Modify the algorithm so that it keeps passengers on the same line when possible. [3pt]


The goal of the third major modification is to improve the graphical user interface of the program. To use the given program, a passenger must look through two huge menus. To avoid this, the program should start with two short menus. Each of those should offer five choices: green, red, orange, blue, and all. When the passenger clicks on the search button, the menus should be replaced with a matching list of stations. [3pts] You may also wish to replace the button click with a double click on a menu item. [1pt]

Here is a full usage cycle for the Java program:

  • the passenger sees this initially:
    start
  • after a passenger chooses two lines, this view shows up:
    lines
  • finally the search result shows up and the original menus:
    back

Here is a full usage cycle for the Scheme program (click on the images for full-size views):

  • the passenger sees this initially:
    start
  • after a passenger chooses two lines, this view shows up:
    lines
  • finally the search result shows up and the original menus:
    back



CSPP 51090 & CMSC 22001: Software Construction