Project 3
Spring 2001
Due: Mar 28th @ 4 PM
9 points
You thought it'd be a great idea to take a class on basket weaving over the summer to knock off some of those pesky general electives. During the first few days of class, you were trying to butter up your professor by mentioning that you had taken a programming class and that many regard the Jacquard loom as one of the first programmable computers. As soon as the professor found out that you knew how to program, he enlisted you to write a program to compute his grades. Since the assessment of one's basket-weaving skill is often subjective, you felt compelled to comply. After all, no one on Wall Street or in Silicon Valley would give you a job with a B in basket weaving on your transcript.
As fate would have it, your professor is a world-renowned basket weaver, so students from all over the world come to take his class over the summer: undergraduate students, graduate students, and continuing-ed students. Like most world-renowned basket weavers, your professor is a bit eccentric and insists on grading each type of student on a different scale.
The continuing-ed students receive a pass/fail grade based on a final project. Everyone else must take midterm and final exams worth 20% and 30% of their grade, respectively. In addition, undergraduates must submit five projects worth 5%, 5%, 10%, 10%, and 20%. The graduate students, those lazy bums, submit a final project worth 20%, but the remainder of their grade is based on a written report.
The old basket weaver is pretty set in his ways, and for years he has been storing his grades in a file format that is as quixotic as his baskets. He starts with the file that the Registrar provides, removes the unnecessary information, and adds the grades following each student's name. The first field is the student's name and is delimited by double quotes. The second is the student's classification: U1, U2, U3, and U4 are for undergraduates, GRD for graduate students, and CED for continuing-ed students. The professor lists all of the grades in the order in which the occur during the semester. For the undergraduates, it is the grade for P1, P2, the midterm, P3, P4, P5, and the final. For the graduates, it is the midterm, the project, the paper, and the final exam. The continuing-ed students just have one grade. Here's the the file he gave you:
"Josh Carbone" U4 75.3 89.3 65.3 56.3 89.8 93.4 98.7 "Charles M. Babbage" GRD 93.4 78.3 85.6 94.2 "Susan Gregory Jacobson" CED 90.3
For output, the old professor wants to see the student's name (no quotes), followed by their class (e.g., U1 or CED), their numeric average, and their letter grade. The college uses the plus/minus system (A, A-, B+,...) with anything less than 64 being an F. For continuing-ed students, if their numeric grade is above 70, they pass with a grade of P; otherwise, they fail with a grade of F.
This also is a transaction processing program, so the solution will be similar to that for Project 2. However, for this project, you you have variable-length records, and you should use functions to compute the numeric average for each type of student and to determine a student's letter grade. You may need to write other functions.
Hint: Start by writing a function that extracts a string enclosed between two double quotes from an input file stream: string extractName(ifstream &fin) or void getName(ifstream &fin, string &name).
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 3 // Name: <your name> // SID: <last four digits of student ID> // E-mail: <e-mail address> // Instructor: Maloof // TA: <TA's name> // COSC 071-<section number> // // Description: <Describe your program> //
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 proj3.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 < proj3.ccYou 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 ``< proj3.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 4:00 P.M. on the due date. Late projects will be subject to a penalty. Do not send your project from a MIME-enable mail client.
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.