Please help, this needs to be in C++, if there needs to be some changes that is okay, but it needs the TeamLeader must inherit from ProductionWorker and such. I cannot get the following to compile at all! If I remove the TeamLeader everything works okay, but when I add it, it doesnt work.
MAIN.CPP #include #include "ProductionWorker.h" #include "ShiftSupervisor.h" #include "TeamLeader.h" using namespace std; int main(){ ProductionWorker pw("John Jones", "123", "1/1/2006", 2, 18.00); cout << pw.productionWorkerString(); pw.~ProductionWorker(); cout<< " " << endl; ShiftSupervisor ss("Roy C", "124", "1/1/2012", 48000, 4200); cout << ss.shiftSupervisorString(); ss.~ShiftSupervisor(); cout<< " " << endl; TeamLeader tl("Alexander M", "12", "1/1/2012", 3, 18.00, 500, 8, 5); cout< #include"Employee.h" class TeamLeader: public ProductionWorker { private: int monthlyB; int trainingHoursR; int trainingHoursA; public: TeamLeader(); TeamLeader(std::string empName, std::string empNum, std::string hireDate, int shift, double hourlyPayRate, int monthlyB, int trainingHoursR, int trainingHoursA); std::string teamLeaderString(); int getMonthlyB(){return monthlyB;} void setMonthlyB(int monthlyB){this->monthlyB = monthlyB;} int getTrainingHoursR(){return trainingHoursR;} void setTrainingHoursR(int trainingHoursR){this->trainingHoursR=trainingHoursR;} int getTrainingHoursA(){return trainingHoursA;} void getTrainingHoursA(int trainingHoursA){this->trainingHoursA=trainingHoursA;} }; #endif //FINAL_TEAMLEADER.H TEAMLEADER.CPP #include #include #include #include #include "ProductionWorker.h" #include "TeamLeader.h" std::string TeamLeader::teamLeaderString(){ std::cout << Employee::EmployeeString(); std::cout << ProductionWorker::productionWorkerString(); std::cout << "Monthly Bonus: " << monthlyB << std::endl; std::cout << "Required Training Hours: " << trainingHoursR << std::endl; std::cout << "Required Training Hours Completed: "<< trainingHoursA << std::endl; } TeamLeader::TeamLeader(std::string empName, std::string empNum, std::string hireDate, int shift, double hourlyPayRate, int monthlyB, int trainingHoursR, int trainingHoursA) { this->monthlyB=monthlyB; this->trainingHoursR=trainingHoursR; this->trainingHoursA=trainingHoursA; } PRODUCTIONWORKER.CPP #include #include #include "ProductionWorker.h" #include #include std::string ProductionWorker::productionWorkerString(){ std::cout << Employee::EmployeeString(); 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(std::string empName, std::string empNum, std::string hireDate, int shift, double payRate) : Employee(empName, empNum, hireDate){ this->shift = shift; this->hourlyPayRate = payRate;} ProductionWorker::~ProductionWorker() { } 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); ~ProductionWorker(); std::string productionWorkerString(); 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.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); ~ShiftSupervisor(); std::string shiftSupervisorString(); 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 SHIFTSUPERVISOR.CPP #include #include"ShiftSupervisor.h" #include #include #include "Employee.h" std::string ShiftSupervisor::shiftSupervisorString() { std::cout << Employee::EmployeeString(); std::stringstream ss; std::cout<<"Annual Salary: "<salaryA=salaryA; this->productionA=productionA; } ShiftSupervisor::~ShiftSupervisor() { } EMPLOYEE.CPP #include #include #include #include "Employee.h" #include std::string Employee::EmployeeString(){ std::stringstream ss; ss << "Employee Name: " << empName << std::endl; ss << "Number: " << empNum < 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 EmployeeString(); 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;} }; #endif //FINAL_EMPLOYEE_H