(Latest Revision: 03/14/2001)

Using A List of Structures: Computer Dating Service


THE ASSIGNMENT:

Your assignment is to write a simple version of a program for a computer dating service. Each client will gives his or her name, phone number, and a list of interests. It will be the job of your program to maintain lists of men and women using the service and to match up "compatible" couples.

DATA STRUCTURES:

The problem requires you to maintain two separate lists of clients, one for men and one for women. You are not required to keep the lists in any particular order. New clients may be added to the end of the appropriate list.

Each list element must include all the following information for one client: You must adapt the list class given in chapter 3 of our text for use as the lists of clients in this program. The source code for the list class is included in the assignment directory.

INPUT:

All input for the program must come from two text files, called clients and datecoms.

(You must write the program to use precisely those names for the input files. Even adding an extension -- for example "clients.txt" will interfere with my plans for testing your program.)

The clients input file contains data about current clients in the following format:

1. Number of current clients
2. For each current client, the following information:


Gender  ......................  1 character, M or F
Last Name ....................  string 
First Name ...................  string 
Phone Number .................  string 
Number of interests ..........  integer in the range [3-10]
List of interests ............  3-10 strings, no embedded white space,
                                all lower case
List position of match .......  non-negative integer
Each item must be on a line by itself in the clients file. Here is a very simple example of a clients input file:



2

M
pTwain
Mark
667-1234
4
bait_fishing
rafting
restaurants
writing_novels
0

F
Millay
Edna
566-8821
3
french_restaurants
mythology
poetry
0



When the program starts up, it must open and read the clients input file. It must use the information there to build initial versions of the two client lists.

The second input file datecoms contains commands to be performed. Each command will begin with a command word, on a new line of input.

INFORMATION ON EACH COMMAND:

THE NEWCLIENT COMMAND:
NEWCLIENT Command Format:
NEWCLIENT <gender> <last name> <first name> <phone number> <number of interests> <interests>
Example Call To NEWCLIENT:
NEWCLIENT F Jones Jennifer 223-3321 4 bridge drink food fun  
What The NEWCLIENT Command Does: The effect of the NEWCLIENT command is to add the new client to the appropriate list by inserting a new list item containing the gender, names, and other information from the command arguments. (Don't forget that each list item has a "current match" field, which is required to have a value.) The NEWCLIENT command also attempts to find a match for the new client. A match is a previously unmatched client of the opposite sex with three or more interests equal to interests of the new client. The NEWCLIENT command looks for just one match for the new client. If it finds one it designates both persons as matched, as described in the section on data structures above. It then prints the name of the new client, the name of his or her match, and both phone numbers. If no match is found, it prints an appropriate message. (See the sample program output given in file "SampleRun/cout.out")

THE UNMATCH COMMAND:
UNMATCH Command Format: 
UNMATCH <last name> <first name>
Example Call To UNMATCH:
UNMATCH Newman Paul
What The UNMATCH Command Does: The UNMATCH command undoes the effect of a matching of two persons. The caller of the command includes two string arguments: the last and first names of one of the persons. The UNMATCH command locates the records of both persons and sets both current match fields to zero.

THE PRINTMATCH COMMAND:
PRINTMATCH Command Format:  
PRINTMATCH 
Example Call To PRINTMATCH:  
PRINTMATCH 
What The PRINTMATCH Command Does: This command prints a list of all matched pairs, giving full names and phone numbers of each person. (See the sample program output given in file "SampleRun/cout.out.")

THE PRINTFREE COMMAND:
PRINTFREE Command Format:  
PRINTFREE
Example Call To PRINTFREE:  
PRINTFREE 
What The PRINTFREE Command Does: This command prints the full names and phone numbers of clients who are not currently matched. (See the sample program output given in file "SampleRun/cout.out.")

THE QUIT COMMAND:
QUIT Command Format:  
QUIT
Example Call To QUIT:  
QUIT 
What The QUIT Command Does: The effect of this command is just to write some final output and make the program stop executing. (This command must appear as the last line of the datecoms file. See the sample program output given in file "SampleRun/cout.out.")

OUTPUT:

The program must send the output corresponding to the commands above to standard output. It must do appropriate labelling and delimiting: the response to each command must be contained in a clearly marked separate section of output, with labels printed to make clear the meaning of each piece of output. The program must echo the command itself at the beginning of each section of output. (See the sample program output given in file "SampleRun/cout.out.")

After receiving the QUIT command and before terminating execution, the program must write the contents of the two client lists to a file called clients.out in a format suitable for later use as a clients (input) file.

(You must write the program to use precisely that name: clients.out)


What To Turn In:

You will be sending me three e-mail messages. Please follow these rules: Here is the list of things you have to turn in:
  1. On the first due date e-mail a shar'd level two version. Use this subject line: CS2500,prog3.2.

  2. On the second due date e-mail a shar'd version in which the source code is finished down to level two everywhere, and also finished to the final level in the "buildList" and "dumpList" areas. (Refer to the structure chart for the program.) Use this subject line: CS2500,prog3.3.

  3. On the third due date e-mail a shar'd final version. Use this subject line: CS2500,prog3.f.

Note that there are no spaces in the subject lines given. It is important that you do not insert any spaces. My e-mail address is: john@ishi.csustan.edu.


DUE DATES:

For due dates, see the class schedule.