Homework 4 - Basic Inheritance

Due: Wednesday, February 17, 2009 at 5:00pm
NOTE: No late assignments will be accepted beyond Friday February 19th 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:

                 Employee
                 /      \
                /        \
               /          \
       hourlyEmployee    salariedEmployee
Use hw4main.cpp as your main function. If you use seperate compilation, you will need to modify hw4main.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 hw4main.cpp) if you use seperate compilation. Alternatively, you can just code all of these class within hw4main.cpp and submit just that file.

Use the following lists of features to code each class.

Employee class

The is the parent class. It defines the name and social security number. It also defines how many weeks are in the pay period for the employee.
Private section
Public section

hourlyEmployee class

This class inherits from the Employee class publically. It defines an employee who gets paid by the hour. Be sure to verify that the hours worked are positive and that the rate is above minimum wage.
Private section
Public section

salariedEmployee class

This class inherits from the Employee class publically. It defines an employee who gets paid a fixed, monthly salary. Be sure to verify that the monthly salary is positive.
Private section
Public section