Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

In C++ Exercise 013 Extra Credit Write the definition of the derived class of class Employee (that you have defined in exercise 09) named HourlyEmployee

image text in transcribedimage text in transcribedIn C++

Exercise 013 Extra Credit Write the definition of the derived class of class Employee (that you have defined in exercise 09) named HourlyEmployee as follows: 1. It has three additional private data members named hours (integer) and payRate (double precision), and overtime (double precision). Their default values are 0 for hours, and $0.00 for payRate and overtime. 2. It also has a private member function void computeBaseOvertimePay ( ) that computes the base pay and the overtime pay as follows: a. If the value of the data member hours is less than or equal to 35, then it does the following: i. Set the value of the inherited data member base pay to payRate times hours. ii. Set the value of the data member overtime to 0.00. b. Otherwise, it does the following: i. Set the value of the inherited data member base pay to pay Rate times 35. ii. Set the value of the data member overtime to pay Rate times 1.5 times (hours - 35). 3. The constructor with parameters has the following function header: HourlyEmployee( string fn, string In, int ID, Date bd, Date hd, int hrs, double prate) Where hrs represents the number of hours of work and prate the pay rate. It calls class Employee's constructor with 0 as the argument for the data member base pay, and then calls the private member function computeBaseOvertimePay ) to set the values of the data members base pay and overtime. 4. In addition to the constructors, it has the following public member functions: a. int getHours( void) returns the value of the data member hours. b. double getPayRate(void) returns the value of the data member payRate. c. double getOvertime( void) returns the value of the data member overtime. 5. Member function void readPayInfo() is redefined in the class HourlyEmployee: it now reads the values of the data members hours and payRate, and then calls the private member function computeBaseOvertime Pay() to set the values of the data members base pay and overtime. 6. Member function double getGpay() is redefined in the class Hourly Employee: it now returns the sum of the values of the data members base pay and overtime. 7. Member function double computeTax() is redefined in the class HourlyEmployee: It now calls the redefined member function getGpay ) to get the gross pay and then computes the tax deduction in the same way as in exercise 09. 8. Member function void printPayInfo() is redefined in the class Hourly Employee: it now outputs the values of the data members hours, payRate, base pay, and overtime, in addition to the gross pay, tax deduction, and net pay, 9. Place the definition of this class in the header file HourlyEmployee.h and the definitions of the member functions in the source file HourlyEmployee.epp. 10. Note: the header files Employee.h must be included in the header file HourlyEmployee.h. Assuming that member function double getGpay() is a virtual member function of the class Employee, rewrite the definition of the class HourlyEmployee without redefining the member function double computeTax() of the base class Employee

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

Modern Database Management

Authors: Jeffrey A. Hoffer Fred R. McFadden

9th Edition

B01JXPZ7AK, 9780805360479

More Books

Students also viewed these Databases questions