Lab 6 - Basic Inheritance
Due: 10:00am on Wednesday
The purpose of this lab is to define a parent class and a child class for
employee objects.
In this lab, you will be defining a child class, hourlyEmployee, that has
been derived from the Employee class. The Employee class is given in
lab6.cpp along with the main() function. You will
need to define the child class in order for the given code to compile since
main() has an hourlyEmployee object.
Define the child class using the following guidelines.
hourlyEmployee has the following member variables:
- rate - the employee's hourly pay rate, expressed as a double
- hours - the number of hours the employee has worked in that pay period,
expressed as either a double or integer (your choice)
hourlyEmployee will also need to override the following member functions
from the parent class:
- setEmployee() - Along with asking for the name and SSN, also ask for
the employee's hourly pay rate and how many hours the employee has worked
in this pay period. Set the member variables accordingly.
- printPaycheck() - The paycheck should print the employee's
net salary (rate * hours) for that pay period, along with their name
and last 4 of their SSN.
hourlyEmployee will also need a default constructor which sets the rate and
hours to 0, along with invoking the parent class constructor to initialize
the name and SSN to the empty string.
Email lab6.cpp to me when you have completed defining the child class.