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

Write a console program that implements these classes. In main, write a “driver

ID: 3620656 • Letter: W

Question

Write a console program that implements these classes. In main, write a “driver program” that fully tests the functionality of each class.

Use the Date class from the text. (This is composition.) Because all outsourced employees have an ID value of zero, set this value in the Employee constructor call in the OutsourcedEmployee constructor.

In main, create several employees of each type and initialize each employee’s data after you create it.

Create an array of Employee pointers, and Assign each of the pointers to one of the employee objects. Polymorphically process the Employees in a loop using the array of pointers to calculate total payroll. (This is run-time polymorphism).

class Employee {
private:
int ID;
public:
char name[80];
char address[80];
char phone[80];
Date birthDate;
Date hireDate;
Employee(int id);
int GetID();
virtual double getMonthsPay() = 0;
};

class SalariedEmployee : public Employee {
public:
double salary;
double getMonthsPay();
SalariedEmployee(int id);
};

class HourlyEmployee : public Employee {
public:
double hours;
double hourlyRate;
double getMonthsPay();
HourlyEmployee(int id);
};

/* All outsourced employees have an ID code of zero
and are paid a flat salary rate of $20/month. */
class OutsourcedEmployee : public SalariedEmployee {
public:
double getMonthsPay();
OutsourcedEmployee();
};

Explanation / Answer

Dear, #include using namespace std; // Member function definitions for Date class. class Date { public: Date(){} // default constructor void setDate(); void print() const; // print date in month/day/year format private: int month; // 1-12 int day; // 1-31 based on month int year; // any year // utility function to test proper day for month and year int checkDay( int ) const; }; void Date:: setDate() { int mn,dy,yr; coutdy; coutmn; coutyr; if ( mn > 0 && mn
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