1answer.
Ask question
Login Signup
Ask question
All categories
  • English
  • Mathematics
  • Social Studies
  • Business
  • History
  • Health
  • Geography
  • Biology
  • Physics
  • Chemistry
  • Computers and Technology
  • Arts
  • World Languages
  • Spanish
  • French
  • German
  • Advanced Placement (AP)
  • SAT
  • Medicine
  • Law
  • Engineering
tekilochka [14]
3 years ago
15

In a particular factory, a team leader is an hourly paid production worker who leads a small team. In addition to hourly pay, te

am 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. The TeamLeader class should have fields 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 methods for the class. Demonstrate the class by writing a program that uses a TeamLeader object.
Computers and Technology
1 answer:
Ray Of Light [21]3 years ago
8 0

Answer:

#include <iostream>

#include <iomanip>

#include <string>

using namespace std;

class Employee

{

private:

string name; // Employee name

string number; // Employee number

string hireDate; // Hire date

public:

Employee()

{ name = ""; number = ""; hireDate = ""; }

Employee(string aName, string aNumber, string aDate)

{ name = aName; number = aNumber; hireDate = aDate; }

void setName(string n)

{ name = n; }

void setNumber(string num)

{ number = num; }

void setHireDate(string date)

{ hireDate = date; }

string getName() const

{ return name; }

string getNumber() const

{ return number; }

string getHireDate() const

{ return hireDate; }

};

class ProductionWorker : public Employee

{

private:

int shift; // The worker's shift

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

public:

ProductionWorker() : Employee()

{ shift = 0; payRate = 0.0; }

ProductionWorker(string aName, string aNumber, string aDate,

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

{ shift = aShift; payRate = aPayRate; }

void setShift(int s)

{ shift = s; }

void setPayRate(double r)

{ payRate = r; }

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:

};

void displayInfo(ProductionWorker);

void displayInfo(TeamLeader);

int main()

{

ProductionWorker pw("John Jones", "123", "1/1/2006", 2, 18.00);

displayInfo(pw);

/* remove the comment to enable

TeamLeader leader("John Jones", "123", "1/1/2006", 2, 18.00,

500.0, 20.0, 12.5);

displayInfo(leader);

*/

return 0;

}

void displayInfo(ProductionWorker e)

{

cout << setprecision(2) << fixed << showpoint;

cout << "Name: "

<< e.getName() << endl;

cout << "Employee number: "

<< e.getNumber() << endl;

cout << "Hire date: "

<< e.getHireDate() << endl;

cout << "Shift: "

<< e.getShiftName() << endl;

cout << "Shift number: "

<< e.getShiftNumber() << endl;

cout << "Pay rate: "

<< e.getPayRate() << endl;

}

void displayInfo(TeamLeader e)

{

/* enable this section to print

cout << setprecision(2) << fixed << showpoint;

cout << "Name: "

<< e.getName() << endl;

cout << "Employee number: "

<< e.getNumber() << endl;

cout << "Hire date: "

<< e.getHireDate() << endl;

cout << "Shift: "

<< e.getShiftName() << endl;

cout << "Shift number: "

<< e.getShiftNumber() << endl;

cout << "Pay rate: "

<< e.getPayRate() << endl;

cout << "Monthly bonus: $"

<< e.getMonthlyBonus() << endl;

cout << setprecision(1);

cout << "Required training hours: "

<< e.getRequiredTraining() << endl;

cout << "Completed training hours: "

<< e.getCompletedTraining() << endl;

*/

}

Hope it helps.

You might be interested in
What is a good principle to implement when you find yourself attempting to
Maurinko [17]

its less is more A

to much could make it really bad

5 0
4 years ago
The more _____ a thumb drive has, the more storage capability it will provide. Hertz, bytes or pixels. The more _____ a micropro
beks73 [17]

Answer:

a) bytes

b) hertz

c) 1) hertz  and 2) bytes

Explanation:

A byte is the basic unit of information and data stored in a computer storage.  Hence, the storage capability of a drive will be measured in Bytes. On the other hand speed of processor is measured in terms of number of cycles made per second i.e hertz. Hence, the higher the value of hertz the higher is the speed of the computer.

5 0
3 years ago
A computer network is _____.
ad-work [718]

Answer:

a

Explanation:

a group of people who help you solve any technical issues

3 0
3 years ago
You defined a book data type.
tensa zangetsu [6.8K]

Answer:

myBook = book()

Explanation:

Correct answer edge 2020

4 0
3 years ago
Which feature is commonly found in a Website management editor?
likoan [24]

give the task to team members

hope this help

7 0
3 years ago
Other questions:
  • Windows Hello supports multiple biometric authentication methods, including facial recognition. What is the failsafe method to a
    6·1 answer
  • What mode is generally used when delivering a presentation to an audience?
    8·2 answers
  • Which is an example of line-of-sight Internet service?<br> Cable<br> DSL<br> Fiber<br> WiMax
    7·1 answer
  • SXXSSSSSSSSSZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZ
    14·1 answer
  • . Write a C++ Code to get a multiline statement Str1 from a user with a ‘$’ as return character (Hint:
    6·1 answer
  • Kali linux os and window os who is the best​
    5·2 answers
  • Create a program that calculates the tip and total for a meal at a restaurant. Type the code into an IDLE IDE editor window and
    5·1 answer
  • Give one reason why more people prefer to settle in areas of flat land than on steep slopes​
    8·2 answers
  • The Ingenuity and the MOXIE are two new pieces of technology on the Perseverance. What role will these instruments play? How wil
    6·2 answers
  • How to make your nest learning thermostat stop doing something
    14·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!