SlideShare a Scribd company logo
1 of 8
Download to read offline
This code has nine errors, but I don't know how to solve it.
Please give me a code that resolves all errors and executes well. Please provide the code for
each file name.
( Employee.h, Employee.cpp, ProductionWorker.h, ProductionWorker.cpp,
TeamLeader.h, TeamLeader.cpp, Main.cpp)
Please provide all 7 modified file codes.
I have left a question about this problem many times, but everyone provides an incomplete
incorrect answer code.
(Some code truncated, execution error) I want you to give me a complete code with the
error removed.
Employee.h
#include <iostream>
#include <cstdlib>
#include <string>
#include <iomanip>
using namespace std;
class Employee
{
private:
string employeeName;
string employeeNumber;
string hireDate;
public:
Employee(); // default constructor
Employee(string name, string number, string date); // constructor with parameters
void setEmployeeName(string employeeName); // set employee name
void setEmployeeNumber(string employeeNumber); // set employee number
void setHireDate(string hireDate); // set hire date
string getEmployeeName() const; // get employee name
string getEmployeeNumber() const; // get employee number
string getHireDate() const; // get hire date
};
Employee.cpp
#include <iostream>
#include <cstdlib>
#include <string>
#include <iomanip>
#include "Employee.h"
Employee::Employee()
{
cout << "Please answer some questions about your employees. " << endl;
}
// Constructor with parameters
Employee::Employee(string name, string number, string date)
{
employeeName = name;
employeeNumber = number;
hireDate = date;
}
// Set employee name
void Employee::setEmployeeName(string name)
{
employeeName = name;
}
// Set employee number
void Employee::setEmployeeNumber(string number)
{
employeeNumber = number;
}
// Set hire date
void Employee::setHireDate(string date)
{
hireDate = date;
}
// Get employee name
string Employee::getEmployeeName() const
{
return employeeName;
}
// Get employee number
string Employee::getEmployeeNumber() const
{
return employeeNumber;
}
// Get hire date
string Employee::getHireDate() const
{
return hireDate;
}
ProductionWorker.h
#include <iostream>
#include <cstdlib>
#include <string>
#include <iomanip>
#include "Employee.h"
using namespace std;
class ProductionWorker : public Employee
{
private:
int shift;
int hourlyPay;
public:
ProductionWorker(); // default constructor
ProductionWorker(string name, string number, string date, int s, int pay); // constructor with
parameters
void setShift(int shift); // set shift
void setHourlyPay(int pay); // set hourly pay
int getShift() const; // get shift
int getHourlyPay() const; // get hourly pay
};
ProductionWorker.cpp
#include <iostream>
#include <cstdlib>
#include <string>
#include <iomanip>
#include "ProductionWorker.h"
// Default constructor
ProductionWorker::ProductionWorker()
{
cout << "Your responses will be displayed after all data has been received." << endl;
}
// Constructor with parameters
ProductionWorker::ProductionWorker(string name, string number, string date, int s, int pay)
: Employee(name, number, date)
{
shift = s;
hourlyPay = pay;
}
// Set shift
void ProductionWorker::setShift(int s)
{
shift = s;
}
// Set hourly pay
void ProductionWorker::setHourlyPay(int pay)
{
hourlyPay = pay;
}
// Get shift
int ProductionWorker::getShift() const
{
return shift;
}
// Get hourly pay
int ProductionWorker::getHourlyPay() const
{
return hourlyPay;
}
TeamLeader.h
#include <iostream>
#include <cstdlib>
#include <string>
#include <iomanip>
#include "ProductionWorker.h"
using namespace std;
class TeamLeader : public ProductionWorker
{
private:
int monthlyBonus;
int requiredTrainingHours;
int attendedTrainingHours;
public:
TeamLeader();
TeamLeader(string name, string number, string date, int s, int pay, int bonus, int
reqTrainingHours, int attTrainingHours);
void setMonthlyBonus(int bonus);
void setRequiredTrainingHours(int hours);
void setAttendedTrainingHours(int hours);
int getMonthlyBonus() const;
int getRequiredTrainingHours() const;
int getAttendedTrainingHours() const;
};
TeamLeader.cpp
#include <iostream>
#include <cstdlib>
#include <string>
#include <iomanip>
#include "TeamLeader.h"
TeamLeader::TeamLeader()
{
cout << "Your responses will be displayed after all data has been received." << endl;
}
TeamLeader::TeamLeader(string name, string number, string date, int s, int pay, int bonus, int
reqTrainingHours, int attTrainingHours)
: ProductionWorker(name, number, date, s, pay)
{
monthlyBonus = bonus;
requiredTrainingHours = reqTrainingHours;
attendedTrainingHours = attTrainingHours;
}
void TeamLeader::setMonthlyBonus(int bonus)
{
monthlyBonus = bonus;
}
void TeamLeader::setRequiredTrainingHours(int hours)
{
requiredTrainingHours = hours;
}
void TeamLeader::setAttendedTrainingHours(int hours)
{
attendedTrainingHours = hours;
}
int TeamLeader::getMonthlyBonus() const
{
return monthlyBonus;
}
int TeamLeader::getRequiredTrainingHours() const
{
return requiredTrainingHours;
}
int TeamLeader::getAttendedTrainingHours() const
{
return attendedTrainingHours;
}
Main.cpp
#include <iostream>
#include <cstdlib>
#include <string>
#include <iomanip>
#include "Employee.h"
#include "ProductionWorker.h"
#include "TeamLeader.h"
using namespace std;
int main()
{
string name, number, date;
int shift, requiredTrainingHours, attendedTrainingHours;
int hourlyPay, monthlyBonus;
// Get employee information
cout << "Enter employee name: ";
getline(cin, name);
cout << "Enter employee ID: ";
getline(cin, number);
cout << "Enter hire date: ";
getline(cin, date);
cout << "Enter shift (1 for day, 2 for night): ";
cin >> shift;
cout << "Enter pay rate: ";
cin >> hourlyPay;
cout << "Enter bonus rate: ";
cin >> monthlyBonus;
cout << "Enter training hours: ";
cin >> attendedTrainingHours;
cout << "Enter required hours: ";
cin >> requiredTrainingHours;
// Create team leader object
TeamLeader tl(name, number, date, shift, hourlyPay, monthlyBonus, requiredTrainingHours,
attendedTrainingHours);
// Display employee and production worker information
cout << "===================================" << endl;
cout << "The employee name : " << tl.getEmployeeName() << endl;
cout << fixed << setprecision(2) << "The Pay Rate : " << tl.getHourlyPay() << endl;
cout << "The employee ID : " << tl.getEmployeeNumber() << endl;
cout << "The Hire Date : " << tl.getHireDate() << endl;
cout << "Shift : " << (tl.getShift() == 1 ? "Day" : "Night") << endl;
// Display team leader information
cout << fixed << setprecision(2) << "Bonus Rate : " << tl.getMonthlyBonus() << endl;
cout << "Training hours : " << tl.getAttendedTrainingHours() << endl;
cout << "Required hours : " << tl.getRequiredTrainingHours() << endl;
return 0;
}
This code has nine errors- but I don't know how to solve it- Please gi (1).pdf

More Related Content

Similar to This code has nine errors- but I don't know how to solve it- Please gi (1).pdf

C++ Language -- Dynamic Memory -- There are 7 files in this project- a.pdf
C++ Language -- Dynamic Memory -- There are 7 files in this project- a.pdfC++ Language -- Dynamic Memory -- There are 7 files in this project- a.pdf
C++ Language -- Dynamic Memory -- There are 7 files in this project- a.pdf
aassecuritysystem
 
CONSTRUCTORS, DESTRUCTORS AND OPERATOR OVERLOADING.pptx
CONSTRUCTORS, DESTRUCTORS AND OPERATOR OVERLOADING.pptxCONSTRUCTORS, DESTRUCTORS AND OPERATOR OVERLOADING.pptx
CONSTRUCTORS, DESTRUCTORS AND OPERATOR OVERLOADING.pptx
DeepasCSE
 
in C++ Design a class named Employee The class should keep .pdf
in C++ Design a class named Employee The class should keep .pdfin C++ Design a class named Employee The class should keep .pdf
in C++ Design a class named Employee The class should keep .pdf
adithyaups
 
friends functionToshu
friends functionToshufriends functionToshu
friends functionToshu
Sidd Singh
 
So i am trying to finish this code using structures and could use som.pdf
So  i am trying to finish this code using structures and could use som.pdfSo  i am trying to finish this code using structures and could use som.pdf
So i am trying to finish this code using structures and could use som.pdf
aksahnan
 
So I already have most of the code and now I have to1. create an .pdf
So I already have most of the code and now I have to1. create an .pdfSo I already have most of the code and now I have to1. create an .pdf
So I already have most of the code and now I have to1. create an .pdf
arjuncollection
 

Similar to This code has nine errors- but I don't know how to solve it- Please gi (1).pdf (20)

C++ Language -- Dynamic Memory -- There are 7 files in this project- a.pdf
C++ Language -- Dynamic Memory -- There are 7 files in this project- a.pdfC++ Language -- Dynamic Memory -- There are 7 files in this project- a.pdf
C++ Language -- Dynamic Memory -- There are 7 files in this project- a.pdf
 
Lecture2.ppt
Lecture2.pptLecture2.ppt
Lecture2.ppt
 
CONSTRUCTORS, DESTRUCTORS AND OPERATOR OVERLOADING.pptx
CONSTRUCTORS, DESTRUCTORS AND OPERATOR OVERLOADING.pptxCONSTRUCTORS, DESTRUCTORS AND OPERATOR OVERLOADING.pptx
CONSTRUCTORS, DESTRUCTORS AND OPERATOR OVERLOADING.pptx
 
54602399 c-examples-51-to-108-programe-ee01083101
54602399 c-examples-51-to-108-programe-ee0108310154602399 c-examples-51-to-108-programe-ee01083101
54602399 c-examples-51-to-108-programe-ee01083101
 
computer project code ''payroll'' (based on datafile handling)
computer project code ''payroll'' (based on datafile handling)computer project code ''payroll'' (based on datafile handling)
computer project code ''payroll'' (based on datafile handling)
 
2 BytesC++ course_2014_c3_ function basics&parameters and overloading
2 BytesC++ course_2014_c3_ function basics&parameters and overloading2 BytesC++ course_2014_c3_ function basics&parameters and overloading
2 BytesC++ course_2014_c3_ function basics&parameters and overloading
 
CP 04.pptx
CP 04.pptxCP 04.pptx
CP 04.pptx
 
Fundamentals of functions in C program.pptx
Fundamentals of functions in C program.pptxFundamentals of functions in C program.pptx
Fundamentals of functions in C program.pptx
 
in C++ Design a class named Employee The class should keep .pdf
in C++ Design a class named Employee The class should keep .pdfin C++ Design a class named Employee The class should keep .pdf
in C++ Design a class named Employee The class should keep .pdf
 
C++ file
C++ fileC++ file
C++ file
 
C++ file
C++ fileC++ file
C++ file
 
friends functionToshu
friends functionToshufriends functionToshu
friends functionToshu
 
OOPS 22-23 (1).pptx
OOPS 22-23 (1).pptxOOPS 22-23 (1).pptx
OOPS 22-23 (1).pptx
 
The Ring programming language version 1.5.3 book - Part 91 of 184
The Ring programming language version 1.5.3 book - Part 91 of 184The Ring programming language version 1.5.3 book - Part 91 of 184
The Ring programming language version 1.5.3 book - Part 91 of 184
 
OOPS using C++
OOPS using C++OOPS using C++
OOPS using C++
 
So i am trying to finish this code using structures and could use som.pdf
So  i am trying to finish this code using structures and could use som.pdfSo  i am trying to finish this code using structures and could use som.pdf
So i am trying to finish this code using structures and could use som.pdf
 
Building Services With gRPC, Docker and Go
Building Services With gRPC, Docker and GoBuilding Services With gRPC, Docker and Go
Building Services With gRPC, Docker and Go
 
Constructor and Destructors in C++
Constructor and Destructors in C++Constructor and Destructors in C++
Constructor and Destructors in C++
 
So I already have most of the code and now I have to1. create an .pdf
So I already have most of the code and now I have to1. create an .pdfSo I already have most of the code and now I have to1. create an .pdf
So I already have most of the code and now I have to1. create an .pdf
 
cpp-streams.ppt,C++ is the top choice of many programmers for creating powerf...
cpp-streams.ppt,C++ is the top choice of many programmers for creating powerf...cpp-streams.ppt,C++ is the top choice of many programmers for creating powerf...
cpp-streams.ppt,C++ is the top choice of many programmers for creating powerf...
 

More from aamousnowov

More from aamousnowov (20)

Theresa has many iCU potsents in her care- Some of the potients are on.pdf
Theresa has many iCU potsents in her care- Some of the potients are on.pdfTheresa has many iCU potsents in her care- Some of the potients are on.pdf
Theresa has many iCU potsents in her care- Some of the potients are on.pdf
 
Theresa has many ICU patients in her care- Some of the patients are on.pdf
Theresa has many ICU patients in her care- Some of the patients are on.pdfTheresa has many ICU patients in her care- Some of the patients are on.pdf
Theresa has many ICU patients in her care- Some of the patients are on.pdf
 
There is duality between monitors and message passing- What is that du (1).pdf
There is duality between monitors and message passing- What is that du (1).pdfThere is duality between monitors and message passing- What is that du (1).pdf
There is duality between monitors and message passing- What is that du (1).pdf
 
There are several types of interests that may be at stake in a negotia.pdf
There are several types of interests that may be at stake in a negotia.pdfThere are several types of interests that may be at stake in a negotia.pdf
There are several types of interests that may be at stake in a negotia.pdf
 
There is an unequal distribution of news coverage regarding disasters-.pdf
There is an unequal distribution of news coverage regarding disasters-.pdfThere is an unequal distribution of news coverage regarding disasters-.pdf
There is an unequal distribution of news coverage regarding disasters-.pdf
 
There is an archaeological study area located in southwestern NewMexic.pdf
There is an archaeological study area located in southwestern NewMexic.pdfThere is an archaeological study area located in southwestern NewMexic.pdf
There is an archaeological study area located in southwestern NewMexic.pdf
 
There is a disease called by two copies of a recessive allele- xx- On.pdf
There is a disease called by two copies of a recessive allele- xx- On.pdfThere is a disease called by two copies of a recessive allele- xx- On.pdf
There is a disease called by two copies of a recessive allele- xx- On.pdf
 
There are two ways that the tilt of the Earth's axis causes the summer.pdf
There are two ways that the tilt of the Earth's axis causes the summer.pdfThere are two ways that the tilt of the Earth's axis causes the summer.pdf
There are two ways that the tilt of the Earth's axis causes the summer.pdf
 
There doesn't appear to be a statistical difference in the means (you'.pdf
There doesn't appear to be a statistical difference in the means (you'.pdfThere doesn't appear to be a statistical difference in the means (you'.pdf
There doesn't appear to be a statistical difference in the means (you'.pdf
 
There have been many examples where the use of AI and Data Mining to m.pdf
There have been many examples where the use of AI and Data Mining to m.pdfThere have been many examples where the use of AI and Data Mining to m.pdf
There have been many examples where the use of AI and Data Mining to m.pdf
 
There has been a debate over how climate change impact the incidence a.pdf
There has been a debate over how climate change impact the incidence a.pdfThere has been a debate over how climate change impact the incidence a.pdf
There has been a debate over how climate change impact the incidence a.pdf
 
There are 60 students in a class- 10 are graduate students- We form a.pdf
There are 60 students in a class- 10 are graduate students- We form a.pdfThere are 60 students in a class- 10 are graduate students- We form a.pdf
There are 60 students in a class- 10 are graduate students- We form a.pdf
 
Theme- Understanding relevance and centrality based information reteri.pdf
Theme- Understanding relevance and centrality based information reteri.pdfTheme- Understanding relevance and centrality based information reteri.pdf
Theme- Understanding relevance and centrality based information reteri.pdf
 
There are 100 inhabitants on a remote island in the year 2000 - The po.pdf
There are 100 inhabitants on a remote island in the year 2000 - The po.pdfThere are 100 inhabitants on a remote island in the year 2000 - The po.pdf
There are 100 inhabitants on a remote island in the year 2000 - The po.pdf
 
their state of happiness (Happy or Not Happy) and income (Low- Medium-.pdf
their state of happiness (Happy or Not Happy) and income (Low- Medium-.pdftheir state of happiness (Happy or Not Happy) and income (Low- Medium-.pdf
their state of happiness (Happy or Not Happy) and income (Low- Medium-.pdf
 
There are 24 evenly distributed nodes on an 8 port 100 BaseT HUB- What.pdf
There are 24 evenly distributed nodes on an 8 port 100 BaseT HUB- What.pdfThere are 24 evenly distributed nodes on an 8 port 100 BaseT HUB- What.pdf
There are 24 evenly distributed nodes on an 8 port 100 BaseT HUB- What.pdf
 
The z-test statistic is (Raund to two docimal plizces as naodod-).pdf
The z-test statistic is (Raund to two docimal plizces as naodod-).pdfThe z-test statistic is (Raund to two docimal plizces as naodod-).pdf
The z-test statistic is (Raund to two docimal plizces as naodod-).pdf
 
There are 15 freshmen and 17 sophomore students in a classroom- We ran.pdf
There are 15 freshmen and 17 sophomore students in a classroom- We ran.pdfThere are 15 freshmen and 17 sophomore students in a classroom- We ran.pdf
There are 15 freshmen and 17 sophomore students in a classroom- We ran.pdf
 
There are numerous sales apps that are very popular with sales people.pdf
There are numerous sales apps that are very popular with sales people.pdfThere are numerous sales apps that are very popular with sales people.pdf
There are numerous sales apps that are very popular with sales people.pdf
 
There are several benefits to incorporating a business- Which of the f.pdf
There are several benefits to incorporating a business- Which of the f.pdfThere are several benefits to incorporating a business- Which of the f.pdf
There are several benefits to incorporating a business- Which of the f.pdf
 

Recently uploaded

SURVEY I created for uni project research
SURVEY I created for uni project researchSURVEY I created for uni project research
SURVEY I created for uni project research
CaitlinCummins3
 
Spellings Wk 4 and Wk 5 for Grade 4 at CAPS
Spellings Wk 4 and Wk 5 for Grade 4 at CAPSSpellings Wk 4 and Wk 5 for Grade 4 at CAPS
Spellings Wk 4 and Wk 5 for Grade 4 at CAPS
AnaAcapella
 

Recently uploaded (20)

FICTIONAL SALESMAN/SALESMAN SNSW 2024.pdf
FICTIONAL SALESMAN/SALESMAN SNSW 2024.pdfFICTIONAL SALESMAN/SALESMAN SNSW 2024.pdf
FICTIONAL SALESMAN/SALESMAN SNSW 2024.pdf
 
SURVEY I created for uni project research
SURVEY I created for uni project researchSURVEY I created for uni project research
SURVEY I created for uni project research
 
ĐỀ THAM KHẢO KÌ THI TUYỂN SINH VÀO LỚP 10 MÔN TIẾNG ANH FORM 50 CÂU TRẮC NGHI...
ĐỀ THAM KHẢO KÌ THI TUYỂN SINH VÀO LỚP 10 MÔN TIẾNG ANH FORM 50 CÂU TRẮC NGHI...ĐỀ THAM KHẢO KÌ THI TUYỂN SINH VÀO LỚP 10 MÔN TIẾNG ANH FORM 50 CÂU TRẮC NGHI...
ĐỀ THAM KHẢO KÌ THI TUYỂN SINH VÀO LỚP 10 MÔN TIẾNG ANH FORM 50 CÂU TRẮC NGHI...
 
Trauma-Informed Leadership - Five Practical Principles
Trauma-Informed Leadership - Five Practical PrinciplesTrauma-Informed Leadership - Five Practical Principles
Trauma-Informed Leadership - Five Practical Principles
 
Book Review of Run For Your Life Powerpoint
Book Review of Run For Your Life PowerpointBook Review of Run For Your Life Powerpoint
Book Review of Run For Your Life Powerpoint
 
TỔNG HỢP HƠN 100 ĐỀ THI THỬ TỐT NGHIỆP THPT TOÁN 2024 - TỪ CÁC TRƯỜNG, TRƯỜNG...
TỔNG HỢP HƠN 100 ĐỀ THI THỬ TỐT NGHIỆP THPT TOÁN 2024 - TỪ CÁC TRƯỜNG, TRƯỜNG...TỔNG HỢP HƠN 100 ĐỀ THI THỬ TỐT NGHIỆP THPT TOÁN 2024 - TỪ CÁC TRƯỜNG, TRƯỜNG...
TỔNG HỢP HƠN 100 ĐỀ THI THỬ TỐT NGHIỆP THPT TOÁN 2024 - TỪ CÁC TRƯỜNG, TRƯỜNG...
 
male presentation...pdf.................
male presentation...pdf.................male presentation...pdf.................
male presentation...pdf.................
 
OS-operating systems- ch05 (CPU Scheduling) ...
OS-operating systems- ch05 (CPU Scheduling) ...OS-operating systems- ch05 (CPU Scheduling) ...
OS-operating systems- ch05 (CPU Scheduling) ...
 
Basic Civil Engineering notes on Transportation Engineering & Modes of Transport
Basic Civil Engineering notes on Transportation Engineering & Modes of TransportBasic Civil Engineering notes on Transportation Engineering & Modes of Transport
Basic Civil Engineering notes on Transportation Engineering & Modes of Transport
 
Including Mental Health Support in Project Delivery, 14 May.pdf
Including Mental Health Support in Project Delivery, 14 May.pdfIncluding Mental Health Support in Project Delivery, 14 May.pdf
Including Mental Health Support in Project Delivery, 14 May.pdf
 
Spellings Wk 4 and Wk 5 for Grade 4 at CAPS
Spellings Wk 4 and Wk 5 for Grade 4 at CAPSSpellings Wk 4 and Wk 5 for Grade 4 at CAPS
Spellings Wk 4 and Wk 5 for Grade 4 at CAPS
 
Analyzing and resolving a communication crisis in Dhaka textiles LTD.pptx
Analyzing and resolving a communication crisis in Dhaka textiles LTD.pptxAnalyzing and resolving a communication crisis in Dhaka textiles LTD.pptx
Analyzing and resolving a communication crisis in Dhaka textiles LTD.pptx
 
MOOD STABLIZERS DRUGS.pptx
MOOD     STABLIZERS           DRUGS.pptxMOOD     STABLIZERS           DRUGS.pptx
MOOD STABLIZERS DRUGS.pptx
 
TỔNG HỢP HƠN 100 ĐỀ THI THỬ TỐT NGHIỆP THPT TOÁN 2024 - TỪ CÁC TRƯỜNG, TRƯỜNG...
TỔNG HỢP HƠN 100 ĐỀ THI THỬ TỐT NGHIỆP THPT TOÁN 2024 - TỪ CÁC TRƯỜNG, TRƯỜNG...TỔNG HỢP HƠN 100 ĐỀ THI THỬ TỐT NGHIỆP THPT TOÁN 2024 - TỪ CÁC TRƯỜNG, TRƯỜNG...
TỔNG HỢP HƠN 100 ĐỀ THI THỬ TỐT NGHIỆP THPT TOÁN 2024 - TỪ CÁC TRƯỜNG, TRƯỜNG...
 
Spring gala 2024 photo slideshow - Celebrating School-Community Partnerships
Spring gala 2024 photo slideshow - Celebrating School-Community PartnershipsSpring gala 2024 photo slideshow - Celebrating School-Community Partnerships
Spring gala 2024 photo slideshow - Celebrating School-Community Partnerships
 
Mattingly "AI & Prompt Design: Named Entity Recognition"
Mattingly "AI & Prompt Design: Named Entity Recognition"Mattingly "AI & Prompt Design: Named Entity Recognition"
Mattingly "AI & Prompt Design: Named Entity Recognition"
 
The Story of Village Palampur Class 9 Free Study Material PDF
The Story of Village Palampur Class 9 Free Study Material PDFThe Story of Village Palampur Class 9 Free Study Material PDF
The Story of Village Palampur Class 9 Free Study Material PDF
 
Sternal Fractures & Dislocations - EMGuidewire Radiology Reading Room
Sternal Fractures & Dislocations - EMGuidewire Radiology Reading RoomSternal Fractures & Dislocations - EMGuidewire Radiology Reading Room
Sternal Fractures & Dislocations - EMGuidewire Radiology Reading Room
 
Major project report on Tata Motors and its marketing strategies
Major project report on Tata Motors and its marketing strategiesMajor project report on Tata Motors and its marketing strategies
Major project report on Tata Motors and its marketing strategies
 
PSYPACT- Practicing Over State Lines May 2024.pptx
PSYPACT- Practicing Over State Lines May 2024.pptxPSYPACT- Practicing Over State Lines May 2024.pptx
PSYPACT- Practicing Over State Lines May 2024.pptx
 

This code has nine errors- but I don't know how to solve it- Please gi (1).pdf

  • 1. This code has nine errors, but I don't know how to solve it. Please give me a code that resolves all errors and executes well. Please provide the code for each file name. ( Employee.h, Employee.cpp, ProductionWorker.h, ProductionWorker.cpp, TeamLeader.h, TeamLeader.cpp, Main.cpp) Please provide all 7 modified file codes. I have left a question about this problem many times, but everyone provides an incomplete incorrect answer code. (Some code truncated, execution error) I want you to give me a complete code with the error removed. Employee.h #include <iostream> #include <cstdlib> #include <string> #include <iomanip> using namespace std; class Employee { private: string employeeName; string employeeNumber; string hireDate; public: Employee(); // default constructor Employee(string name, string number, string date); // constructor with parameters void setEmployeeName(string employeeName); // set employee name void setEmployeeNumber(string employeeNumber); // set employee number void setHireDate(string hireDate); // set hire date string getEmployeeName() const; // get employee name string getEmployeeNumber() const; // get employee number string getHireDate() const; // get hire date }; Employee.cpp
  • 2. #include <iostream> #include <cstdlib> #include <string> #include <iomanip> #include "Employee.h" Employee::Employee() { cout << "Please answer some questions about your employees. " << endl; } // Constructor with parameters Employee::Employee(string name, string number, string date) { employeeName = name; employeeNumber = number; hireDate = date; } // Set employee name void Employee::setEmployeeName(string name) { employeeName = name; } // Set employee number void Employee::setEmployeeNumber(string number) { employeeNumber = number; } // Set hire date void Employee::setHireDate(string date) { hireDate = date; } // Get employee name string Employee::getEmployeeName() const { return employeeName; } // Get employee number string Employee::getEmployeeNumber() const {
  • 3. return employeeNumber; } // Get hire date string Employee::getHireDate() const { return hireDate; } ProductionWorker.h #include <iostream> #include <cstdlib> #include <string> #include <iomanip> #include "Employee.h" using namespace std; class ProductionWorker : public Employee { private: int shift; int hourlyPay; public: ProductionWorker(); // default constructor ProductionWorker(string name, string number, string date, int s, int pay); // constructor with parameters void setShift(int shift); // set shift void setHourlyPay(int pay); // set hourly pay int getShift() const; // get shift int getHourlyPay() const; // get hourly pay }; ProductionWorker.cpp #include <iostream> #include <cstdlib> #include <string> #include <iomanip> #include "ProductionWorker.h" // Default constructor ProductionWorker::ProductionWorker()
  • 4. { cout << "Your responses will be displayed after all data has been received." << endl; } // Constructor with parameters ProductionWorker::ProductionWorker(string name, string number, string date, int s, int pay) : Employee(name, number, date) { shift = s; hourlyPay = pay; } // Set shift void ProductionWorker::setShift(int s) { shift = s; } // Set hourly pay void ProductionWorker::setHourlyPay(int pay) { hourlyPay = pay; } // Get shift int ProductionWorker::getShift() const { return shift; } // Get hourly pay int ProductionWorker::getHourlyPay() const { return hourlyPay; } TeamLeader.h #include <iostream> #include <cstdlib> #include <string> #include <iomanip> #include "ProductionWorker.h" using namespace std;
  • 5. class TeamLeader : public ProductionWorker { private: int monthlyBonus; int requiredTrainingHours; int attendedTrainingHours; public: TeamLeader(); TeamLeader(string name, string number, string date, int s, int pay, int bonus, int reqTrainingHours, int attTrainingHours); void setMonthlyBonus(int bonus); void setRequiredTrainingHours(int hours); void setAttendedTrainingHours(int hours); int getMonthlyBonus() const; int getRequiredTrainingHours() const; int getAttendedTrainingHours() const; }; TeamLeader.cpp #include <iostream> #include <cstdlib> #include <string> #include <iomanip> #include "TeamLeader.h" TeamLeader::TeamLeader() { cout << "Your responses will be displayed after all data has been received." << endl; } TeamLeader::TeamLeader(string name, string number, string date, int s, int pay, int bonus, int reqTrainingHours, int attTrainingHours) : ProductionWorker(name, number, date, s, pay) { monthlyBonus = bonus; requiredTrainingHours = reqTrainingHours; attendedTrainingHours = attTrainingHours; } void TeamLeader::setMonthlyBonus(int bonus) { monthlyBonus = bonus; }
  • 6. void TeamLeader::setRequiredTrainingHours(int hours) { requiredTrainingHours = hours; } void TeamLeader::setAttendedTrainingHours(int hours) { attendedTrainingHours = hours; } int TeamLeader::getMonthlyBonus() const { return monthlyBonus; } int TeamLeader::getRequiredTrainingHours() const { return requiredTrainingHours; } int TeamLeader::getAttendedTrainingHours() const { return attendedTrainingHours; } Main.cpp #include <iostream> #include <cstdlib> #include <string> #include <iomanip> #include "Employee.h" #include "ProductionWorker.h" #include "TeamLeader.h" using namespace std; int main() { string name, number, date; int shift, requiredTrainingHours, attendedTrainingHours; int hourlyPay, monthlyBonus;
  • 7. // Get employee information cout << "Enter employee name: "; getline(cin, name); cout << "Enter employee ID: "; getline(cin, number); cout << "Enter hire date: "; getline(cin, date); cout << "Enter shift (1 for day, 2 for night): "; cin >> shift; cout << "Enter pay rate: "; cin >> hourlyPay; cout << "Enter bonus rate: "; cin >> monthlyBonus; cout << "Enter training hours: "; cin >> attendedTrainingHours; cout << "Enter required hours: "; cin >> requiredTrainingHours; // Create team leader object TeamLeader tl(name, number, date, shift, hourlyPay, monthlyBonus, requiredTrainingHours, attendedTrainingHours); // Display employee and production worker information cout << "===================================" << endl; cout << "The employee name : " << tl.getEmployeeName() << endl; cout << fixed << setprecision(2) << "The Pay Rate : " << tl.getHourlyPay() << endl; cout << "The employee ID : " << tl.getEmployeeNumber() << endl; cout << "The Hire Date : " << tl.getHireDate() << endl; cout << "Shift : " << (tl.getShift() == 1 ? "Day" : "Night") << endl; // Display team leader information cout << fixed << setprecision(2) << "Bonus Rate : " << tl.getMonthlyBonus() << endl; cout << "Training hours : " << tl.getAttendedTrainingHours() << endl; cout << "Required hours : " << tl.getRequiredTrainingHours() << endl; return 0; }