Question: / / * * * * * * * * * * * * * * * * * * * * * * *
This is the HEADER FILE employee.h
This is the INTERFACE for the class Employee.
This is primarily intended to be used as a base class to derive
classes for different kinds of employees.
#ifndef EMPLOYEEH
#define EMPLOYEEH
#include
using namespace std;
namespace employees
class Employee
public:
Employee;
Employeestring newname, string newssn;
string getname;
string getssn;
void changenamestring newname;
void changessnstring newssn;
void printcheck;
void giveraisedouble amount;
protected:
string name;
string ssn;
double netpay;
;
employees
#endif EMPLOYEEH
File employee.cpp contains the definition of member function for employees class.
hourlyemployee.h is the interface of derived class HourlyEmployee.
The derived HourlyEmployee class, in addition to all member functions and variable members that it inherits from the Employee class, has several additional member functions and variable members defined in its body.
It is possible to take a member function from the parent's class and redefine it in the body of the child class. This is called redefining the inherited member function. For example, the printcheck function is redefined in the HourlyEmployee class. To redefine a function, simply list it in the class definition and give it a new definition, just as you do with any other function.
salariedemployee.h is the interface of another derived class SalariedEmployee.
The derived class is SalariedEmployee and again has additional member functions and variable members to the ones that are already inherited from the Employee class.
Requirement:
Use the above three header files and the following two implementation programs, hourlyemployee.cpp and salariedemployee.cpp Redefine the function giveraise in both HourlyEmployee and SalariedEmployee such that:
Hourlybases employees receive raise on their hourly rate wagerate
Salaried employees receive raise of their salary
This is the HEADER FILE salariedemployee.h
This is the INTERFACE for the class SalariedEmployee.
#ifndef SALARIEDEMPLOYEEH
#define SALARIEDMPLOYEEH
#include
#include "employee.h
using namespace std;
namespace employees
class SalariedEmployee : public Employee
public:
SalariedEmployee;
SalariedEmployee string newname, string newssn double newweeklysalary;
double getsalary;
void changesalarydouble newsalary;
void printcheck;
void giveraisedouble amount;
private:
double salary; weekly
;
employees
This is the HEADER FILE hourlyemployee.h
This is the INTERFACE for the class HourlyEmployee.
#ifndef HOURLYEMPLOYEEH
#define HOURLYEMPLOYEEH
#include
#include "employee.h
using namespace std;
namespace employees
class HourlyEmployee : public Employee
public:
HourlyEmployee;
HourlyEmployeestring newname, string newssn double newwagerate, double newhours;
void setratedouble newwagerate;
double getrate;
void sethoursdouble hoursworked;
double gethours;
void giveraisedouble amount;
void printcheck;
private:
double wagerate;
double hours;
;
employees
#endif HOURLYMPLOYEEH
This is the HEADER FILE employee.h
This is the INTERFACE for the class Employee.
This is primarily intended to be used as a base class to derive
classes for different kinds of employees.
#ifndef EMPLOYEEH
#define EMPLOYEEH
#include
using namespace std;
namespace employees
class Employee
public:
Employee;
Employeestring newname, string newssn;
string getname;
string getssn;
void changenamestring newname;
void changessnstring newssn;
void printcheck;
void giveraisedouble amount;
protected:
string name;
string ssn;
double netpay;
;
employees
#endif EMPLOYEEH
Step by Step Solution
There are 3 Steps involved in it
1 Expert Approved Answer
Step: 1 Unlock
Question Has Been Solved by an Expert!
Get step-by-step solutions from verified subject matter experts
Step: 2 Unlock
Step: 3 Unlock
