12-174

Project 2

Spring 2000

Design Due: 7 April.

Project Due: 24 April.

Administrative Information

Complete the following activities. You must work in pairs for the Project. You may not have more than 2 people on a team. If you cannot find a partner, I will appoint one.

All results must be put into the appropriate project folder on the cs174jb nova account.

All programs must have a heading identifying the people who worked on the project. Programs must also contain appropriate comments. See style sheets.

Project 2

America's Most Wanted

Your assignment is to write a program for a police department that has collected a database of information on various suspects for a given crime. (Luckily for you, the department is only investigating one crime at a time.) Each suspect has a set of attributes, such as shifty eyes, a limp, or a parrot on his shoulder. The maximum number of such attributes for any suspect is not known. Your program accepts commands to manipulate the database in order to narrow down the list of suspects, in the hope of pinpointing the villain.

Input

  1. The retained criminal information, generated by the previous execution of this program, is input from file "Criminal.mf" at the beginning of each execution of the program.

  2. The user inputs commands from the keyboard, in the format shown below. Names and attributes are strings of no more than 20 characters. The program should not be case sensitive (e.g., 'JOE' and 'Joe' are the same name). To simplify the processing, you can assume that names are unique; that is, no two criminals use the same professional handle. The commands are discussed in detail in the Command Processing instructions below.

Output

  1. Responses to user commands are to be written to the screen, as described in the Command Processing instructions below.

  2. Echoprint each command and show the results of any PRINT commands in a file called "Criminal.trn". You may determine the format of the information in this file; it should be labeled and formatted clearly. A hard copy of this file is turned in with your program for grading.

  3. If any new suspects were added (see ADD command), file "Criminal.mf" must be rewritten to contain the updated collection of criminal information.

Command Processing

New suspects can be added to the collection of criminal information using the ADD command. An inquiry consists of a set of commands with respect to a single crime, at the end of which the crime is assumed to be solved. An inquiry must be completed within the execution of the program; it cannot be "saved" to finish on a subsequent execution. After an inquiry is complete, a new inquiry (the investigation of another crime) can begin. Each new inquiry starts over with the entire collection of suspects.