COSC 071: Computer Science I

Project 2
Fall 2003

C++ implementation due: Oct 13 @ 5 PM
5 points

The Department of Defense needs a new system for processing transactions from their on-line bidding system. As we all know, the lowest bid wins. Bidders will go to a Web page and fill out a form with the cost information for their proposal. After submitting all of the cost information, it will be queued and processed. Your program must analyze each bid, conduct checks for data integrity, select the lowest bid, and print it to the console.

Transactions from the Web page will consist of the bidder's name and six costs for personnel, fringe benefits (e.g., health care), equipment, travel, overhead (e.g., administrative support), and the total. Naturally, you can't know how many bids will be submitted for a given project. Each bid or transaction will be of the form:

name personnel fringe equipment travel overhead total
For example,
ACME 25000 6250 11000 4000 15625 61875
Your program must read such records from a file named p2.dta, check to ensure that for each, the sum of the costs equals the stated total cost, and after processing all of the bids, outputs the proposer with the lowest bid. If the program encounters any errors while processing transactions, then it should report them to cerr and continue processing.

An example of a data file, which you can use for development, is

ACME 25000 6250 11000 4000 15625 61875
Mcfadden 12000 2640 0 12000 8052 34692
Hughes 37560 10141.2 20000 1000 28143.708 96844.908
Incorperon 45000 9450 0 10000 28858.5 83308.5
GE 89675 26902.5 5543 6000 52459.875 180580.375
Northgrup 12560 3140 9999 2234 8635 36568
Logicon 17543 2631.45 3250 4200 12104.67 39729.12
Martin 54236 13559 7500 1564 36270.325 113129.325

A program processing these records might produce following output:

gusun% a.out
Processing bids...
There appears to be a calculation error in Incorperon's bid.
Mcfadden submitted the lowest bid of $34692.00
gusun%

If the program cannot open the file p2.dta, then it should issue an appropriate error message and terminate. Note that the TAs will use their own data for grading.

Hints for Development: Start by writing a program that verifies if a bid is correct or incorrect. Assign values for the ACME bid to variables directly. Change the values to make sure the program is catching bad bids.

Next, modify the program so it reads the values for the ACME bid from the file p2.dta. Change the values of the file to make sure the program is still catching bad bids.

Now, modify the program so it reads all bids from the file p2.dta.

Finally, add the logic required so the program keeps track of the lowest bid.

Instructions for Electronic Submission: At the top of the file containing your source code (i.e., the file containing the C++ instructions), place the following header comment, with the appropriate modifications:

//
// Project 2
// Name: <your name>
// ID: <GoCard ID>
// E-mail: <e-mail address>
// Instructor: Maloof
// TA: <TA's name>
// COSC 071
//
// In accordance with the class policies and Georgetown's Honor Code,
// I certify that, with the exceptions of the lecture notes and those
// items noted below, I have neither given nor received any assistance
// on this project.
//
// Description: <Describe your program>
//

Although you may use any C++ compiler to develop your program, it must run under UNIX and must compile using GNU g++. When you are ready to submit your program for grading, if necessary, use SSHWin to transfer your source file from your PC to gusun. Use SSHWin to logon to gusun, and use pine to e-mail it to your TA. Use your netid and the suffix ``.cc'' as the subject.

gusun% pine

When the menu appears, select the item for composing e-mail. Assume that your netid is ab123, the name of your source file is proj2.cpp, and your TA's e-mail address is ``imagoodtamaloof@cs''.

Type your TA's e-mail address in the To field, and type your netid with the .cc suffix in the Subject field (no spaces before or after). Move the cursor down into the MESSAGE TEXT screen, and type the ^R (Ctrl-R) command. Pine will ask for a file name (e.g., proj2.cpp), which it will then load as your message text. At this point, your screen should look something like the following:

Finally, type ^X (Ctrl-X) to send the e-mail to your TA.

IMPORTANT: Do not send your source code as an attachment. Do not use a mail client other than pine.

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 on a university machine (e.g., gusun or cssun) 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.

The TAs who will be grading your projects this semester are listed on the main page. You must e-mail your project before 5 PM on the due date.