Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Using C++ Complete the following exercises 1. In a particular factory, a shift supervisor is a salaried employee who supervises a shift. In addition to

Using C++ Complete the following exercises

1.

In a particular factory, a shift supervisor is a salaried employee who supervises a shift. In addition to a salary, the shift supervisor earns a yearly bonus when his or her shift meets production goals. Design a ShiftSupervisor class that extends the Employee class you created in Problem 1, The ShiftSupervisor class should have a field that holds the annual salary and a field that holds the annual production bonus that a shift supervisor has earned. 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 ShiftSupervisor object.

2.

In a particular factory, a team leader is an hourly paid productions worker that 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 yea. Design a TeamLeader class that extends the ProductionWorker class you designed in Programming Challenge 1. The TeamLeader clas should have fields for the monthly bonus amount, thre required number of training hours, and the number of training hours than 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.

Here is my code for Employee and production worker class:

#include

#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 << "Please answer some questions about your employees, ";

}

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 << "Your responses will be displayed after all data has been received. " << endl;

}

int main(){

ProductionWorker info;

string name;

int num;

int date;

int shift;

double pay;

cout << "Please enter employee name: ";

cin >> name;

cout << "Please enter employee number: ";

cin >> num;

cout << "Please enter employee hire date using the format ";

cout << "2 digit month, 2 digit day, 4 digit year as one number: ";

cout << "(Example August 12 1981 = 08121981)";

cin >> date;

cout << "Which shift does the employee work: ";

cout << "Enter 1, 2, or 3";

cin >> shift;

cout << "Please enter the employee's rate of pay: ";

cin >> pay;

info.setemployeeName(name);

info.setemployeeNumber(num);

info.sethireDate(date);

info.setShift(shift);

info.sethourlyPay(pay);

cout << "The data you entered for this employee is as follows: ";

cout << "Name: " << info.getemployeeName() << endl;

cout << "Number: " << info.getemployeeNumber() << endl;

cout << "Hire Date: " << info.gethireDate() << endl;

cout << "Shift: " << info.getShift() << endl;

cout << setprecision(2) << fixed;

cout << "Pay Rate: " << info.gethourlyPay() << endl;

system("pause");

return 0;

}

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_2

Step: 3

blur-text-image_3

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

Oracle Database 19c DBA By Examples Installation And Administration

Authors: Ravinder Gupta

1st Edition

B09FC7TQJ6, 979-8469226970

More Books

Students also viewed these Databases questions

Question

Distinguish between a soft system and a hard system.

Answered: 1 week ago

Question

What are Measures in OLAP Cubes?

Answered: 1 week ago

Question

How do OLAP Databases provide for Drilling Down into data?

Answered: 1 week ago

Question

How are OLAP Cubes different from Production Relational Databases?

Answered: 1 week ago