COSC 071: Computer Science I

Project 4
Spring 2001

Due: Apr 18th @ 4 PM
9 points

The old basket weaver loved your program. In fact, he now wants an interactive program that will let him enter new students and their grades, compute course averages, find students by name, and save any changes to disk. (This is what you get for doing a good job.)

He needs the new program for his fall semester course, and fortunately for you, only undergraduates take it. You don't have to worry about those lazy grad students or any other tourists. Some more bad news: The old professor picked up the book The Complete Idiot's Guide to Object-Oriented Programming and is now convinced that this new program must be 100% classes and objects (i.e., no functions, except maybe a friend function or two).

The format of the input file needs to change slightly for this new design. The student's name will still be in the first field and delimited by double quotes, but the next five numbers will be the project grades, and the last two numbers will be the midterm and final, respectively.

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 data members and methods. You must follow this design.

Steps for Development:

  1. Design a data file.

  2. Implement the Student class for a single student and his or her grades. Use incremental development: code, compile, test, etc. Use a simple ``driver'' program to create instances of the Student class and to test each of the various methods:
    int main()
    {
      Student student;                  // Tests the default constructor
      cout << student;                  // Tests the overloaded stream insertion operator
      student.printRawGrades();         // Tests the print routines
      student.printSemesterGrades();
      ifstream fin("proj4.dta");
      fin >> student;                   // Tests the stream extraction operator
      student.printRawGrades();
      student.printSemesterGrades();
      student.enterData();
      student.printRawGrades();
      student.printSemesterGrades();
      // and so on...
      return 0;
    } // main
    
    Get the first statement working, the default constructor. Then code the overloaded operator, compile and test it. Then code printRawGrades, get that working, and keep continuing in this fasion.

  3. Implement the StudentList class for storing all of the students and their grades. Again, use a simple driver program to create instances and to test the various methods.

  4. Finally, implement the GraderApp class for the interactive features of the program. Your program should read data from a file named proj4.dta and should write data to a file named proj4.out.

Use comments to document the program, the purpose of each class, and any nontrivial methods or functions.

Your main function should look something like the following:

int main()
{
  GraderApp theApp("proj4");
  theApp.processCommands();
  return 0;
} // main

Here is a sample run.

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 4
// 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 proj4.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 < proj4.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 ``< proj4.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. Late projects will be subject to a penalty.

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.