Question: In this exercise, you are given some source code files and asked to make changes to them to demonstrate learning outcomes related to the implementation

In this exercise, you are given some source code files and asked to make changes to them to demonstrate learning outcomes related to the implementation and understanding of inheritance.
Developing the new code and then running the associated main program should demonstrate these learning outcomes:
The ability to understand redefinition of functions by a derived class, originally defined in a base class.
The ability to add new customized features (private member variables, public functions) in a derived class.
The ability to program constructors in a derived class, using their counterparts in the base class.
The ability to define a derived class based on a base class.
Program Requirements
You are provided with definitions of a program in the following files:
employee.h Download employee.h, which contains the class interface of an Employee base class.
employee.cpp Download employee.cpp, which is the implementation file of the Employee base class.
hourlyemployee.h Download hourlyemployee.h, which is the class interface of the HourlyEmployee derived class.
hourlyemployee.cpp Download hourlyemployee.cpp, which is the implementation file of the HourlyEmployee derived class.
salariedemployee.h Download salariedemployee.h, which is the class interface of the SalariedEmployee derived class.
salariedemployee.cpp Download salariedemployee.cpp, which is the implementation file of the SalariedEmployee derived class.
dsal01.cpp Download dsal01.cpp, which is a test program for salaried employees.
dhour01.cpp Download dhour01.cpp, which is a test program for hourly employees.
These will compile and run as written. This exercise asks you to make changes according to the instructions below.
Activity 1)
This activity requires you to add new private members and a new public member function to each derived class.
Use the provided employee code and test programs (dsal01.cpp Download dsal01.cppand dhour01.cpp Download dhour01.cpp) to modify the employee base class and the derived salaried and hourly classes, as follows:
Add:
Member variables:
Salaried: add a private occupation field (a string), and accessor/mutator functions to set it and return it. setOccupation() and getOccupation().
Hourly: add private job field (a string), and accessor/mutator functions to set it and return it. setJob() and getJob().
Function(s):
In each derived class, add a (newly defined) print() member function to each of the derived classes.
This function should print information about the employee using all available information (base class variables, accessed through accessor functions, and derived class variables).
Ensure that the print function in the derived classes also prints the 'generic' base class data name and SSN.
This means: you'll need to access data that is private in the base class.
There are functions provided in the base class to do this.
Ensure that the print function in each of the derived classes also prints the new "custom" things introduced, i.e.
In the SalariedEmployee class, it also prints the occupation
In the HourlyEmployee class, it also prints the job.
Modify the test program to demonstrate use of the new functions in the derived class.
Activity 2)
This activity requires you to redefine a function for the derived class that's already provided in the base class, wherein the derived class version uses some of the functionality of the base class version.
Make a new separate copy of the provided code, as this uses some of the same functions/variables but modifies them in different ways.
Use the provided employee code and test program to modify the employee base class and the derived salaried and hourly classes, as follows:
In the base Employee class, create a print() member function that prints out the name and SSN.
declare versions of the print function (same prototype) in each derived class. In part, this means you are redefining, not overloading.
In the print function in each derived class, add specific functionality for the derived class. This means:
salaried includes salary and occupation
hourly includes hours worked, hourly rate, and job.
The derived class print function should call the base class's print function so that the 'generic' values common to each are also printed.
Activity 3)
This activity requires you to create a new derived class that uses functions provided in the base class, wherein the derived class version uses some of the functionality of the base class version and introduces some of its own.
Make a new separate copy of the provided code, as this uses some of the same things but modifies them in different ways.
You will need these files, which should not need to be modified:
employee.hDownload employee.h
employee.cppDownload employee.cpp
You will need to create these files:
contractemployee.h, which is the header file for the ContractEmployee derived class.
contractemployee.cpp, which is the implementation file for the ContractEmployee derived class.
You may wish to copy portions

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!