Homework 5 - Basic Inheritance

Due: Wednesday, February 22, 2012 at 5:30pm
NOTE: No late assignments will be accepted beyond Friday February 24th so that the solutions can be posted before Midterm 2.

Coding Conventions

Use the same coding conventions as described in Homework 1. Additionally, make sure to indent each section of the class in the class definition.

Assignment

The purpose of this assignment is to create two children classes.

You will define the following class hierarchy:

                  Person
                 /      \
                /        \
               /          \
           Student       Faculty
Use hw5main.cpp as your main function. If you use seperate compilation, you will need to modify hw5main.cpp to include the filenames you use for your header files. Also, be sure to submit all files (header files, implementation files and the modified hw5main.cpp) if you use seperate compilation. Alternatively, you can just code all of these class within one monolithic hw5.cpp file and submit just that file.

Use the following lists of features to code each class.

Person class

The is the parent class. It defines the name, ID number and email address for a person.
Private section
Public section

Student class

This class inherits from the Person class publically. It defines a student with a number of units taken, total weighted grades (the grade for each course multiplied by the units for that course is the weighted grade) and major.
Private section
Public section

Faculty class

This class inherits from the Person class publically. It defines an faculty member who works for a department and gets paid a monthly salary.
Private section
Public section
Email either all the separate compilation files or the one monolithic hw5.cpp file to submit the assignment.