Homework 7 - Basic Classes (Extra Credit)

Due: Saturday November 20, 2010 at 5:00pm

NOTE: Since this is an extra credit assignment, NO late assignments will be accepted. The solution will be posted Saturday evening so you can study it before the final on Monday November 22nd.

The purpose of this assignment is to modify Homework 6 to use classes instead of structures. Each class object will be a single student record for the course. Name your source code hw7.cpp.

The class should be called StudentRecord. It will have the following member variables:

The class will also have the following member functions: You MUST enforce the following data constraints in the mutator function for each member variable. Return true when the passed values are acceptable and false when they are not. In main(), you will create an array of StudentRecords and use a menu to manipulate this array. As with Homework 6, each menu item will call a function, passing the array to the function. Unlike Homework 6 where the function called other global functions, your global functions for this assignment will call member functions inside the class.

As with Homework 6, the ONLY global variable allowed will be the maximum capacity of the array. ALL other variables MUST be local to their functions or the main() function.

Use the following menu for the program:

  Welcome to the StudentRecord Gradebook
  ======================================
  1.  Enter student data for the class
  2.  Print all student records
  3.  Print a single student record

  0.  Exit
  ======================================
  Enter selection:
You will be using a variety of functions to implement these options. Option 1 will call a global getAllStudents() function. Option 2 will check if student data has been entered. If there are students, it will call a global printAllStudents() function. If there are no students, it will remind the user to select Option 1 first. Option 3 will also check if student data has been entered and remind the user to select Option 1 first if there are no students. If there are students, Option 3 will call the global printSelectedStudent() function.

The required global functions are as follows:

Email your completed source code to me.