(Latest Revision: 03/10/2006)
Using A List of Structures: Computer Matching Service
THE ASSIGNMENT:
Your assignment is to write a simple version of a program for a computer
dating service.  Each client will give 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: 
- last name (string)
 - first name (string)
 - phone number (string)
 - number of interests (int -- maximum number is 10) 
 - list of interest strings
 - the list position of this client's current match (int -- set to zero if
    the client has no match)
 
You must adapt the list class given in chapter 3 of our text for use as the
lists of clients in this program.  Source code for the list class is included
in the assignment directory (ListA.h and ListA.cpp). I "customized" the code a
little to help you get started. Also I provided code that you can use as the
data type for the list elements (clientRec.h).  
The list of interests (item 4 above) may be implemented simply as an array of
strings.  (It may seem logical to use the chapter 3 list class to implement
lists of clients and lists of strings.  Fundamentally that is true and
it is possible.  However it entails a "technical problem" - so probably you
should talk to me if you want to do that.)  
INPUT:
All input for the program must come from two text files, called
clients and datecoms.  
(Note that these names (clients and datecoms) do not have
extensions.  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 must contains data about current clients (both
male and female).  The data must be 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
Twain
Mark
667-1234
4
bait_fishing
rafting
restaurants
writing_novels
0
F
Millay
Edna
566-8821
3
french_restaurants
mythology
poetry
0
 
(The 2 at the beginning of the file denotes the fact that this
particular file contains information about two clients.)  
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 list of women and the list of men.  
The second input file datecoms contains commands that the program is
required to execute.  Each command begins with a command keyword, on a new
line of input. 
INFORMATION ON EACH COMMAND:
THE NEWCLIENT COMMAND: 
NEWCLIENT Command Format: 
 NEWCLIENT <gender> <last name> <first name> <phone
#> <# of interests> <interests>  
Example Call To NEWCLIENT: 
 NEWCLIENT F Jones Jennifer 223-3321 4 walks cats movies dancing 
What The NEWCLIENT Command Does:  
 
One effect of the NEWCLIENT command must be 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 tries to to find a match for
the new client.  It does this by attempting to select a previously-unmatched
client of the opposite sex having three or more interests in common with the
interests of the new client.  (In other words if three of the interest strings
of one person are equal to three of the interest strings of a person of
the opposite sex, the program may match those two people.)  
The NEWCLIENT command looks for just one match for the new client.  If
it is successful it appropriately sets the "current match" field in
both list elements: the man's and the woman's. If no match is found
then the new client's "current match" field should be set to zero.  
After taking care of the tasks indicated above the NEWCLIENT command must
print some output.  The output will be different depending on whether a match
was found for the new client.  For the exact specification of what must be
printed, see the sample program output given in file  SampleRun/cout.out.html.
Your program output must exactly match the format of the sample. 
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 reverses the effect of a matching of two persons.  The
command requires two string arguments: the last and first names of one of the
persons.  The UNMATCH command locates the records of both the indicated person
and his or her "current match".  UNMATCH 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.html.  
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.html.
THE QUIT COMMAND: 
QUIT Command Format:  
 QUIT 
Example Call To QUIT:  
 QUIT  
What The QUIT Command Does: 
The effect of this command is to make the program write some output and then
discontinue reading commands from the clients file.  This command
must appear as the last line of the datecoms file.  See the sample
program output given in file 
SampleRun/cout.out.html.  
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.  (When a program echos input to the screen as you enter it
from the keyboard, you should see two copies of each input - because system
software also normally echos your input from the keyboard to the screen.  If
the program is getting input from a file, you will see only the echo done by
your program.) 
Your program output must exactly match the format of the sample program output
given in file  SampleRun/cout.out.html.
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 turning in three hardcopy versions of your program and you will be
sending me three e-mail messages. 
With regard to the e-mail please follow these rules:
-  Always send me e-mail as plain text in the main message body.  Never send
     me attachments.  
 -  Always use the  exact  subject line I specify for each message.
     (I often get hundreds of e-mail messages in a week.  The subject line
     allows me to find, filter and sort messages.)  You will lose a
     significant number of points on the assignment if you use the wrong
     subject line.  
 -  Be very careful when typing the command to send e-mail.  You may use the
     instructions in your
     
     Hello World! lab excercise
     
     for guidance.  Of course, you will need to make the obvious changes to
     those directions -- you have to use the correct subject line and
     filename.  
 -  Always send yourself a copy of each e-mail message you send to me, and
      check immediately  to see if you receive the message intact.
     You are responsible for sending e-mail correctly.
 
Here is the list of things you have to turn in:
-  At the start of class on first due
     date, turn in a hardcopy of a
      level two version of the source code.
     I want hardcopy of all the program source code you wrote, but I don't
     want hardcopy of source code I gave you to incorporate into your program.
     
 -  Send the following items to me by e-mail before midnight on the
     first due date:  
     A 
      
     level two version of the source code
     
     and 
      
     a script
     
 
     showing your test runs.  Send all the source files (*.h files and
     *.cpp files) that are required to compile the program into an executable
     image -- everything I need so that I can compile and test your program.
     Combine all the source files and the script into one
     
     shell archive file
      
     and e-mail me the archive file with the subject line:
     CS2500,prog3.2 
 -  At the start of class on the second due
     date, turn in hardcopy of source code that 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.)
     However, do not give me hardcopy of code I gave you to incorporate into
     your program.  
 -  Send the following items to me by e-mail before midnight on the
     second due date:
     
     -  All the source code you turned in on hardcopy, plus all the rest of
	  the source code needed to compile and test the program - including
	  any code that I gave you that you have incorporated
     
 -  A script showing your test runs
     
 
     Combine all the source files and the script into one
     
     shell archive file
      
     and e-mail me the archive file with the subject line: 
     CS2500,prog3.3 
 -  At the start of class on the third due
     date, turn in a hardcopy of a
      
     final level version of the source code.
     I want hardcopy of all the program source code you wrote, but I don't
     want hardcopy of source code I gave you to incorporate into your program.
     
      -  Send the following items to me by e-mail before midnight on the
	   third due date:  
     A 
      
     final version of the source code
     
     and 
      
     a script 
 
     showing your test runs.  In the e-mail include all the source
     files (*.h files and *.cpp files) that are required to compile the
     program into an executable image -- everything I need so that I can
     compile and test your program.  Combine all the source files and the
     script into one
     
     shell archive file
      
     and e-mail me the archive file with the 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 the due dates, see 
 
the class schedule.