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

Problem 3: Design a class named Employee. The class should keep the following in

ID: 3634103 • Letter: P

Question

Problem 3: Design a class named Employee. The class should keep the following information in member variables:
Employee name
Employee number
Hire 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 wirll hold an integer valuer representing the shift that the employee works. The day shift is shift 1 and night shift is shift 2. Write one or more constructors and the appropriate accessor and mutator functions for the class. Demonstrate the clases by writing a program that uses a productionworker

Explanation / Answer

/*it works for borland compiler...if you face any problem tell me...i'll try to sort out.*/ #include #include #include #include class Employee { char empname[20]; int empnum; char hiredate[15]; public: void setEmpName(char *name) { strcpy(empname,name); } void setHireDate(char *date) { strcpy(hiredate,date); } void setEmpNum(int num) { empnum=num; } char* getEmpName() { return empname; } char* getHireDate() { return hiredate; } int getEmpNum() { return empnum; } Employee() { strcpy(empname,NULL); empnum=0; strcpy(hiredate,NULL); } Employee(char *ename,int eno,char *date) { strcpy(empname,ename); empnum=eno; strcpy(hiredate,date); } }; class ProductionWorker :public Employee { int shift; double hourlyRate; public: void setShift(int s) { shift=s; } void setHourlyRate(double rate) { hourlyRate=rate; } int getShift() { return shift; } double getHourlyRate() { return hourlyRate; } ProductionWorker() { shift=0; hourlyRate=0.0; } ProductionWorker(int s,double rate) { shift=s; hourlyRate=rate; } }; void main() { char ename[20]; char date[20]; int num; int shift; double rate; ProductionWorker pw; coutnum; cout
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