UMBC CMSC201, Computer Science I, Spring '98
Project 4: ACME Home Improvements
Due date: Tuesday, April 28, 1998
You have been hired by ACME Home Improvements, Inc. to write a program
that allows the secretaries to send out form letters to potential
customers, using the data found in ACME's customer file. ACME's owner
wants to save on the mailings by targeting different letters to specific
areas of the city.
Example scenarios might be:
After several days of heavy rain, form letters advertising
basement waterproofing should be sent out to potential customers in low-lying
areas.
If the owner reads about low-cost loans being made available to a
particular commercial area for facade improvement, he wants to
send a form letter advertising exterior painting to businesses in that area.
This project will give you practice with structs, manipulating strings,
file-handling, command-line arguments, and of course design and separate
compilation.
Description of the Program
In order to use your program, the secretary should enter the name of the
executable, the name of the file that contains the form letter to be used,
and the name of the data file that contains the customer records.
At this point the user should be presented with a menu that allows him/her
to choose from several options.
Generate form letters using "filename.txt" for
A - All customers
I - Individual customer
S - Specify customers by zip code and/or type
Q - Quit
Enter your choice :
where choosing 'A' will immediately start generating form letters, one for
each customer in the file;
choosing 'I' will allow the user to enter a specific company name for
commercial customers or lastName for residential customers and generate only
one letter for that customer;
choosing 'S' will prompt the user for as many zipcodes as s/he wishes, and
also give the user the option of picking all customers, only residential
customers, or only commercial customers in those areas. All of the
customers of the type chosen, in each of the zipcodes entered, will have a
form letter produced for them;
and choosing 'Q' allows the user to quit.
After choosing any of these options, the appropriate action should take
place and then this menu should be presented to the user again. The user
must choose Q from this menu to end the program.
The records of the customer file are kept in ascending sorted order on
customer number (custNo) and has the information stored for each record
in the following order:
custNo (int), custType (1 char), companyName (max of 25 chars),
lastName (max of 15 chars), firstName (max of 15 chars),
salut (max of 5 chars), houseNumber (int), streetName (max of 25 chars),
city (max of 20 chars), state (max of 2 chars), zip (max of 5 chars)
where the customer type is a single character, either a C (for commercial)
or an R (for residential). If the customer type is C, there will be a company
name in the companyName field, as well as the first and last names of the
person to contact at that company stored in the firstName and lastName fields.
If the customer type is R, the companyName field should contain a single space.
The fields of the file are separated by commas, and the contents of the fields
themselves are restricted from containing commas.
Example record for each customer type:
104,C,ABC Sales,Smith,Everett,Mr.,11350,McCormick Rd.,Owings Mills,MD,21117
217,R, ,Browning,Samantha,Dr.,1756,N. Charles St.,Baltimore,MD,21201
Design limitations and details
- You must read the entire contents of the customer file, load the data
into an array of structs and close the file before presenting the initial
menu to the user.
- Since I have no interest in killing a forest, and none of you would
like to pay for a lot of printouts, the form letters should NOT be sent
to a printer. Just display the "letters" one after another on the screen
with the individual letters separated by a long line of dashes, as in:
------------------------------------------------------
- There will be two form letters made available to you, that fit the two
scenarios mentioned in the description. (see Copying the files)
- The customer file will have a single integer at the beginning of the
file, which is the number of customer records that file currently contains.
I will provide the customer file. (see Copying the files)
- You will be graded on your design and on the efficiency of the program,
as well as the correctness of the program, documentation and style.
Sample Output
Watch this space for a link to sample output.
Copying the files
The files you need to use for this project are called waterproof.txt,
paint.txt, and customer.dat. They are found in my 201
directory, ~sbogar1/201 You should copy these files into your own directory.
The executable and the data files need to be in the same directory.
Submitting your project
Submit your projects as usual, using the submit command.