Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Please solve this problem so that the result is the same as the uploaded picture. Design a class named Employee. The class should keep the

Please solve this problem so that the result is the same as the uploaded picture.

Design a class named Employee. The class should keep the following information in member variables:

Employee name (string)

Employee number (string)

Hire date (string)

Write one or more constructors and the appropriate accessor and mutator functions for the class. Next, write a class named ProductionWorker that is derived from the Employee class. (5 points)

The ProductionWorker class should have member variables to hold the following information:

Shift (an integer)

Hourly pay rate (a double)

The workday is divided into two shifts: day and night. The shift variable will hold an integer value representing the shift that the employee works. The day shift is shift 1 and the night shift is shift 2.

Write one or more constructors and the appropriate accessor and mutator functions for the class. (5 points)

- In a particular factory, a team leader is an hourly paid production worker who leads a small team. In addition to hourly pay, team leaders earn a fixed monthly bonus. Team leaders are required to attend a minimum number of hours of training per year. Design a TeamLeader class that inherits from the ProductionWorker class you designed up. The TeamLeader class 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. (5 points)

Demonstrate the class by writing a program that uses TeamLeader object by entering the following information:

Employee name:

Employee number:

Hire date:

Shift:

Hourly pay rate:

Fixed Monthly Bonus:

Minimum number of hours of training per year:

Driver program should use overloaded stream operator to display all information related to the created object. (5 points)

Expected output:

image text in transcribed

These codes do not run with numerous errors. Please give me a correct answer.

#include

#include

#include

using namespace std;

class Employee

{

private:

string employeeName;

int employeeNumber;

int hireDate;

public:

void setemployeeName(string employeeName);

void setemployeeNumber(int);

void sethireDate(int);

string getemployeeName() const;

int getemployeeNumber() const;

int gethireDate() const;

Employee();

};

void Employee::setemployeeName(string employeeName)

{

employeeName = employeeName;

}

void Employee::setemployeeNumber(int b)

{

employeeNumber = b;

}

void Employee::sethireDate(int d)

{

hireDate = d;

}

string Employee::getemployeeName() const

{

return employeeName;

}

int Employee::getemployeeNumber() const

{

return employeeNumber;

}

int Employee::gethireDate() const

{

return hireDate;

}

Employee::Employee()

{

cout

}

class ProductionWorker :public Employee

{

private:

int Shift;

double hourlyPay;

public:

void setShift(int);

void sethourlyPay(double);

int getShift() const;

double gethourlyPay() const;

ProductionWorker();

};

void ProductionWorker::setShift(int s)

{

Shift = s;

}

void ProductionWorker::sethourlyPay(double p)

{

hourlyPay = p;

}

int ProductionWorker::getShift() const

{

return Shift;

}

double ProductionWorker::gethourlyPay() const

{

return hourlyPay;

}

ProductionWorker::ProductionWorker()

{

cout

}

class TeamLeader :public Employee , ProductionWorker

{

private :

Double fixedMonthlyBonus;

int reqHoursTraining ;

int attendedHoursTraining ;

Public :

void setFixedMonthlyBonus( double);

void setReqHoursTraining(int);

void setAttendedHoursTraining( double);

double getFixedMonthlyBonus( double);

int getReqHoursTraining(int);

int getAttendedHoursTraining(int);

TeamLeader();

};

void TeamLeader::setFixedMonthlyBonus(double x)

{

fixedMonthlyBonus = x;

}

void TeamLeader::setReqHoursTraining(int y)

{

reqHoursTraining = y;

}

void TeamLeader::setAttendedHoursTraining(int z)

{

attendedHoursTraining = z;

}

double TeamLeader::getFixedMonthlyBonus() const

{

return fixedMonthlyBonus;

}

int TeamLeader::getReqHoursTraining() const

{

return ReqHoursTraining;

}

int TeamLeader::getAttendedHoursTraining() const

{

return attendedHoursTraining;

}

int main()

{

ProductionWorker info;

string name[100];

int num;

int date;

int shift;

double pay;

cout

cin >> name[100];

cout

cin >> num;

cout

cout

cout

cin >> date;

cout

cout

cin >> shift;

cout

cin >> pay;

info.setemployeeName(name[100]);

info.setemployeeNumber(num);

info.sethireDate(date);

info.setShift(shift);

info.sethourlyPay(pay);

cout

cout

cout

cout

cout

cout

cout

cout

system("pause");

return 0;

}

The employee name : Mark The Pay Rate : 30 The employee ID : 124586 The Hire Date : 20210721 Shift : Night Bonus Rate : 100 Training hours : 50 Required hours : 70

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

SQL Antipatterns Avoiding The Pitfalls Of Database Programming

Authors: Bill Karwin

1st Edition

1680508989, 978-1680508987

More Books

Students also viewed these Databases questions

Question

2. Why has the conflict escalated?

Answered: 1 week ago