Question: Meant for C++ programming. Design a TeamLeader class that extends the Production class you designed in programming the below code. The TeamLeader should have member

Meant for C++ programming.

Design a TeamLeader class that extends the Production class you designed in programming the below code. The TeamLeader should have member variables for the monthly bonus amount, the required number of training hours, and the number of training hours that the team leader has attended. Write one or more constructors and the appropriate accessor and mutator functions for the class. Demonstrate the class by writing a small program that uses the TeamLeader object.

main.cpp

#include  #include "ProductionWorker.h" #include "ShiftSupervisor.h" using namespace std; int main(){ ProductionWorker pw("John Jones", 123, "1/1/2006", 2, 18.00); cout << pw.toString(); cout << endl; ShiftSupervisor ss("Roy C", 124, "1/1/2012", 48000, 4200); cout << ss.toString(); cout< 

ProductionWorker.cpp

#include  #include  #include "ProductionWorker.h" #include  #include  std::string ProductionWorker::toString(){ std::cout << Employee::toString(); std::stringstream ss; if (shift == 1) ss << "Shift : day" << std::endl; else if (shift == 2) ss << "Shift : night" << std::endl; ss << "Shift Number :" << shift << std::endl; ss << "Hourly Payrate: " << hourlyPayRate << std::endl; return ss.str(); } ProductionWorker::ProductionWorker(){} ProductionWorker::ProductionWorker(std::string empName, std::string empNum, std::string hireDate, int shift, double payRate) : Employee(empName, empNum, hireDate){ this->shift = shift; this->hourlyPayRate = payRate;}

ProductionWorker.h

 #ifndef FINAL_PRODUCTIONWORKER_H #define FINAL_PRODUCTIONWORKER_H #include "Employee.h" #include  class ProductionWorker : public Employee{ private: int shift; double hourlyPayRate; public: ProductionWorker(); ProductionWorker(std::string empName, std::string empNum, std::string hireDate, int shift, double payRate); std::string toString(); int getShift(){return shift;} void setShift(int shift){this->shift = shift;} double getHourlyPayRate(){return hourlyPayRate;} void setHourlyPayRate(double hourlyPayRate){this->hourlyPayRate = hourlyPayRate;} }; #endif //FINAL_PRODUCTIONWORKER_H 

ShiftSupervisor.cpp

#include #include"ShiftSupervisor.h" #include #include #include "Employee.h" ShiftSupervisor::ShiftSupervisor() {} std::string ShiftSupervisor::toString() { std::cout << Employee::toString(); std::stringstream ss; std::cout<<"Annual Salary: "<salaryA=salaryA; this->productionA=productionA; }

ShiftSupervisor.h

#ifndef FINAL_SHIFTSUPERVISOR_H #define FINAL_SHIFTSUPERVISOR_H #include #include "Employee.h" class ShiftSupervisor : public Employee{ private: int salaryA; int productionA; public: ShiftSupervisor(); ShiftSupervisor(std::string empName, std::string empNum, std::string hireDate, int salaryA, int bonus); std::string toString(); int getSalaryA(){return salaryA;} void setSalaryA(int salaryA){this->salaryA=salaryA;} int getBonus(){return productionA;} void setBonus(int productionA) {this->productionA = productionA;} }; #endif //FINAL_SHIFTSUPERVISOR_H 

Employee.cpp

#include

#include  #include  #include "Employee.h" #include  std::string Employee::toString(){ std::stringstream ss; ss << "Employee Name: " << empName << std::endl; ss << "Number: " << empNum < 

Employee.h

#ifndef FINAL_EMPLOYEE_H #define FINAL_EMPLOYEE_H #include  class Employee{ private: std::string empNum; std::string empName; std::string hireDate; public: Employee(){} Employee(std::string empName, std::string empNum, std::string hireDate){ this->empName = empName; this->empNum = empNum; this->hireDate = hireDate;} std::string getEmpName(){return empName;} void setEmpName(std::string empName){this->empName = empName;} std::string getEmpNum(){return empNum;} void setEmpNum(std::string empNum){this->empNum = empNum;} std::string getHireDate(){return hireDate;} void setHireDate(std::string hireDate){this->hireDate = hireDate;} std::string toString(); }; #endif //FINAL_EMPLOYEE_H

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!