COSC 071: Computer Science I

Project 4
Spring 2000

Due: Apr 12th @ 5 P.M.
9 points

ACME, Inc. needs a program to help them keep track of their inventory, and they want you to design a menu-driven, interactive program that will let them store, retrieve, update, add, and search for products.

Your program should let users interactively

  1. add a new product,
  2. sell products by their codes,
  3. update the inventory when new products arrive,
  4. print the current inventory, and
  5. search for products by their codes.
Naturally, if the user makes any changes to the inventory, the program should should save these changes to the data file when the program terminates.

Each product consists of a product code, a description, a price, and the quantity-on-hand. ACME's inventory presently consists of the following seven products:

Product Code: A501B
Description: Rocket Sled 
Price: $35000
Qty On Hand: 5

Product Code: A301P
Description: Rocket Skates
Price: $7500
Qty On Hand: 3

Product Code: A721Z
Description: Self-Guided Aerial Bomb
Price: $500,000
Qty On Hand: 2

Product Code: A935D
Description: `Little Giant' Firecracker
Price: $50
Qty On Hand: 25

Product Code: A661F
Description: Spring-Powered Shoes
Price: $80
Qty On Hand: 15

Product Code: A511W
Description: 200ft. Long Rubber Band
Price: $750
Qty On Hand: 21

Product Code: A213X
Description: Anvil
Price: $1550
Qty On Hand: 4

Often in team programming situations, senior software engineers analyze a problem and provide junior programmers with a high-level design. We'll do something similar for this project. The high-level design for this project consists of the class definitions and the specifications for the public and private methods. You must follow this specification, although you may add private methods to each class if necessary.

Steps for Development:

  1. Design the format for the data file and create it, keeping in mind that the product descriptions contain spaces. Do not hack around this by changing the spaces to underscores.

  2. Implement the Product class for a single ACME product. Use a simple ``driver'' program to create product instances and to test each of the various methods. Use incremental development: code, compile, test, etc.

  3. Implement the ProductList class for ACME's product line. Again, use a simple driver program to create instances and to test the various methods.

  4. Finally, implement the ACMEApp class for the interactive features of the program.

Your main function should look something like the following:

int main()
{
  ACMEApp theApp("products.dta");
  theApp.HandleEvents();

  return 0;
} // main

Here is a sample run.

At the top of the file containing your source code, place the following header comment, with the appropriate modifications:

//
// Project 4
// Name: <your name>
// SID: <student ID>
// E-mail: <e-mail address>
// TA: <TA's name>
// COSC 071-<section number>
//
// Description: <Describe your program>
//

Instructions for Submission: All programs must run under Unix and must compile using GNU g++. When you are ready to submit your program for grading, e-mail it to your TA using the last four digits of your student ID and the suffix ``.cc'' as the subject line.

For example, if the last four digits of your student ID is 1234, the name of your source file is proj1.cc, and your TA's e-mail address is ``imagoodta@georgetown.edu'', then you would type at the Unix prompt:

gusun% mailx -s "1234.cc" imagoodta@georgetown.edu < proj1.cc
You are executing the mailx command. The -s option indicates that the string "1234.cc" is the subject heading. imgagoodta@georgetown.edu is the address to which the mail will be sent. The part ``< proj1.cc'' takes your source file and directs it into the mailx command.

You can also use pine to submit your project. After filling in the To and Subject fields, type the ^R command in the MESSAGE TEXT screen. Pine will ask for a file name, which it will then load as your message text. Type ^X to send the e-mail.

You must submit your project by e-mail before 5:00 P.M. on the due date.

If you need to include a message to you TA about your submission, then type the message as a comment in the program.

Once you've submitted your project, it is important to keep an electronic copy that preserves the modification date and time. If we lose your project or the e-mail system breaks, then we will need to look at the modification date and time of your project to ensure that you submitted it before it was due.