Question: Modify Program Lb#201-6 i) Employee & ProductionWorker classes in the following ways They should both throw an exception called InvalidDate if the hire date is

Modify Program Lb#201-6 i) Employee & ProductionWorker classes in the following ways

They should both throw an exception called InvalidDate if the hire date is earlier than January 1st 2010

They should throw an InvalidEmpNum if the employee number is less or equal to 0

The Production Worker class should throw an InvalidHourlyRateorShift if the hourly rate is less than is less than or equal to 0 or the shift is not a 1 or 2

#include #include using namespace std; class Employee { private: string name EmpName; int EmpName; string Hiredate; public Employee() { EmpName= " "; EmpNumber= 0; Hiredate= " "; } Employee (string name, int number, string date) { setName(name); EmpNumber=number; Hiredate =date; } void setEmpName (string); void setEmpNumber(int); void setHireDate (string); string getEmpName() ; int getEmpNumber(); string getHireDate(); }; void Employee: :setEmpName (string str) { empName=str; } void Employee : :setEmpNumber (int num) { if (num<0) num=0; empNumber=num; } void Employee: :setHireDate(string date) { Hiredate=date; } string Employee: :get EmpName() { return EmpName; } int Employee: : getEmpNumber() { return EmpNumber; } string Employee: : getHireDate() { return Hiredate; } class ProoductionWorker: public Employee { private : int Shift; double HourlyPay; public: ProductionWorker() { Shift=0; HourlyPay=0; } ProductionWorker (int sh, double pay, int en, string nm, string hd):Employee(nm,en,hd) { Shift=sh; HourlyPay=pay; } void setShift (int); void setHourlyPay(double); int getShift (); double getHourlyPay(); }; void ProductionWorker: : setShift (int sh) { if (sh<1) sh=1; else if (sh>2) sh=2; shift=sh; } void ProductionWorker: : setHourlyPay(double pay) { hourlyPay=Pay; } int ProductionWorker: : getShift() { return Shift; } double ProductionWorker : : getHourlyPay() { return HourlyPay; } int main() { int shift; double pay; cout<<"1-DayShift 2-Night"<>shift; cout<<"enter hourly pay: " cin>>pay; ProductionWorker emp1 ( shift, pay); emp1.setEmpName( "Winston"); emp1.setEmpNumber(562); emp1.setHireDate ( "June : 11"); cout<< "Employee Details: "<

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!