Project 2: Student Records

Assigned:  2 October 2001

Homework Due:  7 October 2001

Project Due: 14 October 2001


Objective

The objective of this assignment is to practice writing C++ classes and using aggregation and sorting algorithms.


Background

We want to write a program to keep track of student records.  Each student has a name, a major, a number of credits, and a student ID number.  We will input the student data from the user, order the students in alphabetical order, and modify the major based on the number of credits.


Assignment

First, prompt the user for the (integer) number of students to be entered.  This number must be nonnegative; if a negative number is entered, reprompt until a nonnegative number is given.  Then, for each student, prompt the user for the name (which will not contain any whitespace), major, number of credits (nonnegative integer), and student ID (positive integer), in that order.  If invalid data is entered for any characteristic, reprompt (for that characteristic only, not the entire student record) until valid data is entered.

Once all the records have been read in, you will modify each student's major.  Each student has a class rank depending on their number of credits: 0-29 is Freshman, 30-59 is Sophomore, 60-89 is Junior, and 90 or more is Senior.  Append the class rank to the major for each student.  For example, if student Billy Bob has 87 credits and his major was entered as Math, then after modification his major should be stored as MathJunior.

Finally, once the majors have been modified, print out all student records in alphabetical order by name.  (You may sort the records before or after the modification of the majors.)  For each student, print the name, student ID, (updated) major, and number of credits, in that order, each on its own line.

IMPORTANT: We will be automating the grading of this project, so you must make sure your output conforms to the standards above.  Specifically, do not print any identifiers on the lines with the data; only the data itself should be printed out, as in the following example:

DO NOT PRINT A GREETING or any other text... just the data as shown below.

BillyBob

21874

MathJunior

87

The data may be interspersed with any number of blank lines. However, do not buffer the output in any way; since there won't be an actual person running your program, don't wait for the user to hit a key before printing the next screen of output, for example.


Homework Portion

The homework portion of this project will be worth 20% of the project grade.  For the homework, create a plain text file (end the filename in .txt) which includes the prototypes of the functions you intend to use, the Student class definition you intend to use, and a one- to two-paragraph (approximately) description of how you intend to solve the problem and the general design of your program.  You may use pseudocode if you wish.  (This file is not intended to be compiled; it is only for you to express the design of your program.)  Your homework will be graded both on the merits of your design (be sure to follow the design principles and practices discussed in class) and on the extent to which you follow that design in the implementation of your program.  Remember to submit your homework file by the homework due date.  Late homework submissions are not accepted.


Requirements

  1. IMPORTANT: Write your program in C++, using the g++ compiler installed in /usr/local/bin on the linux systems at UMBC (linux.gl.umbc.edu). Use C++ input and output, not printf and scanf.  The graders will compile your code using the -ansi and -Wall switches, so make sure to test your program with these.
  2. As per the syllabus, your project must compile (under the above-mentioned compiler) in order to receive credit.  See the syllabus for more details.  Warnings will result in point deductions proportional to the number and severity of warnings generated.
  3. You must write a class named Student; objects of this type will hold the individual student records.  This class must contain two C++ strings for the student name and major (not char arrays).  You will also want two integer fields for the number of credits and student ID; you may have other fields as you see fit.  As always, all fields for all classes you write must be private.
  4. Sort the student records into alphabetical order using either MergeSort or QuickSort.  Modify the code on the 202 web page as necessary (to handle strings instead of numbers, for one thing).  Note that the C++ string class has < , > operators to determine alphabetical order.  You may not use any versions of MergeSort or QuickSort that you do not write yourself (such as the ones in the standard libraries).
  5. You must follow the course style guidelines listed on the course web page, including the creation and submission of a makefile.  Makefiles will be covered in discussion section during the week of 9 October (or feel free to investigate them sooner on your own).  There are also some links to makefile resources from the course web page. Your makefile must name your executable proj2 .
  6. Write and submit separate header, class, and main files, as discussed in lecture.  Your header file may not contain any executable code or function definitions.
  7. When designing your program, pay attention to the design considerations discussed in class.
  8. You must write appropriate constructor and destructor functions for your Student class.  You can (and should) write other member functions, as you see fit.
  9. If you need more information on working with the string class, see the primer posted on the course web page, or the course textbook.  

Submitting your program

You must include the following statement in a comment section of your program:

I have read and I understand the course policy on cheating. By submitting the following program, I am stating that the program was produced by my individual effort.

Turn in your program using the UNIX submit utility, by using the following command at the unix prompt:

submit cs202 proj2 filename

where filename is the name of the file you wish to submit.  Remember to submit a plain text file for the homework assignment, your C++ source files for the project, and your makefile.  After entering this command, you should get a confirmation that submit was successful:

Submitting filename...OK

You can check your submission by entering the command:

submitls cs202 proj2

This will show the names of all files you have submitted for this project, along with the size and submission date and time of each. 

IMPORTANT: No email submissions of projects will be accepted for any reason.  Only electronic submissions, as detailed above, will be accepted.

 


Late Policy Reminder

This project is due by midnight (1 minute after 11:59pm) on Sunday, 14 October 2001. We will use the system clock as the final arbiter of time and date. Projects turned in up to 24 hours late will receive a 10% penalty; project submitted between 24 and 48 hours late will receive a 25% penalty.  Projects will not be accepted past 48 hours after the due date.  Late homework submissions are not accepted; if no homework file is submitted by the due date, you will lose the 20% of the project grade associated with the homework assignment.