Question: How to fix this two programs and demonstrate class by writing a program that uses a TeamLeader object class ProductionWorker : public Employee { private:

How to fix this two programs and demonstrate class by writing a program that uses a TeamLeader object

class ProductionWorker : public Employee

{

private:

int shift; // The worker's shift

double payRate; // The worker's hourly pay rate

public:

// Default constructor

ProductionWorker() : Employee()

{ shift = 0; payRate = 0.0; }

// Constructor

ProductionWorker(string aName, string aNumber, string aDate,

int aShift, double aPayRate) : Employee(aName, aNumber, aDate)

{ shift = aShift; payRate = aPayRate; }

// Mutators

void setShift(int s)

{ shift = s; }

void setPayRate(double r)

{ payRate = r; }

// Accessors

int getShiftNumber() const

{ return shift; }

string getShiftName() const

{ if (shift == 1)

return "Day";

else if (shift == 2)

return "Night";

else

return "Invalid";

}

double getPayRate() const

{ return payRate; }

}

class TeamLeader : public ProductionWorker

{

private:

double monthlyBonus; // Monthly bonus amount

double requiredTraining; // Required training hours

double completedTraining; // Completed training hours

public:

// Default constructor

TeamLeader() : ProductionWorker()

{ monthlyBonus = 0.0; requiredTraining = 0.0;

completedTraining = 0.0;

}

// Constructor

TeamLeader(string aName, string aNumber, string aDate,

int aShift, double aPayRate, double aBonus, double aReqTraining,

double aCompTraining) :

ProductionWorker(aName, aNumber, aDate, aShift, aPayRate)

{ monthlyBonus = aBonus;

requiredTraining = aReqTraining;

completedTraining = aCompTraining;

}

// Mutators

void setMonthlyBonus(double bonus)

{ monthlyBonus = bonus; }

void setRequiredTraining(double rt)

{ requiredTraining = rt; }

void setCompletedTraining(double ct)

{ completedTraining = ct; }

// Accessors

double getMonthlyBonus() const

{ return monthlyBonus; }

double getRequiredTraining() const

{ return requiredTraining; }

double getCompletedTraining() const

{ return completedTraining; }

}

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!