Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

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

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

Step: 3

blur-text-image

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

Students also viewed these Databases questions

Question

Determine miller indices of plane X z 2/3 90% a/3

Answered: 1 week ago

Question

Discuss how S. Truett Cathys values shaped Chick-fil-As operation.

Answered: 1 week ago