CMSC 106 HOMEWORK ASSIGNMENT #4

DUE: January 21, 1998 (start of class)

  1. Below is a sample data file. Type it in and save it as proj4.dat. Each line in this file is a record for a ship, containing the following fields: ship-name, crew-size, displacement, commanders rank and name. Write a program which gets the name of its input file from the command line, then reads a file like this (proj4.dat) into a linked list of ships. The program should allow the user to interactively do one of the following: update the crew-size of a ship, update the rank of a commander, print the complete record for a specific ship, find the smallest ship in terms of displacement and print out the names of the ships in order of displacement.
  2. Document the code. Comments should be brief but informative. A good rule of thumb is a comment for each function. Also a header comment with your name, social security number, the assignment number, a general description of the program and the names of any files in your account needed to execute the program.
  3. Execute the code using the "script" command to retain the run.
  4. Hand in a print-out of the documented code along with the runs.

    enterprise     1026 400000 captain     picard
    voyager        112  125000 captain     janeway
    minnow         2    5      captain     skipper
    constellation  427  270000 commodore   tracy
    pt109          29   115    lieutentant kennedy
    pt19           28   108    commander   mchale