Academic Integrity: tutoring, explanations, and feedback — we don’t complete graded work or submit on a student’s behalf.

C++ assignment question 1. Employee and ProductionWorker ClassesDesign a class n

ID: 3667006 • Letter: C

Question

C++ assignment question

1. Employee and ProductionWorker ClassesDesign a class named Employee.

The class should keep the following information in

Employee name

Employee number

Hire date (A class called 'date')

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. 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. Make the shift an enumerated type. Write one or more constructors and the appropriate accessor and mutator functions for the class.

There should be a Pay function for all employees - pure virtual. For Productio worker, they should be paid their hourly rate plus 1/2 additional if they work the night shift. This combination should be returned from the pay function.


2. ShiftSupervisor Class

ShiftSupervisor Class 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 is derived from the Employeeclass you created in Programming Challenge 1. The ShiftSupervisorclass should have a member variable that holds the annual salary and a member variable that holds the annual production bonus that a shift supervisor has earned. Write one or more constructors and the appropriate accessor and mutator functions for the class.

The Pay function for Shift Supervisor should return a combination of their normal pay and any bonus pay they earn.

Explanation / Answer

class Employee
{
string empName;
int eno;
Date HireDate; //I am hoping that the Date Class is already implemented. If not, it is easily available.
public void setName(string empName)
{
this.empName=empName;
}
public void setNumber(int eno)
{
this.eno=eno;
}
public void setDate(Date HireDate)
{
this.HireDate=HireDate;
}

public Date getDate()
{
return HireDate;
}
public int getNumber()
{
return eno;
}
public string getName()
{
return empName;
}
virtual void getPay()=0;
}

class ProdcutionWroker:public Employee
{
enum shift {1,2}; //set Get and Set Method for these two like done in Employee class
double pay;
void getPay()
{
if(shift==1)
pay=pay;
else if(shift==2)
pay=pay+(0.5*pay);
}
int getMyPay()
{
return pay;
}
}

class ShiftSuperVisor:public Employee
{
int annualSalary;       //set Get and Set Method for these two like done in Employee class
int annualYearlyBonus;

void getPay()
{
if (annualYearlyBonus==0)
annualSalary=annualSalary;
else
annualSalary=annualSalary+annualYearlyBonus;
}


}

Hire Me For All Your Tutoring Needs
Integrity-first tutoring: clear explanations, guidance, and feedback.
Drop an Email at
drjack9650@gmail.com
Chat Now And Get Quote