Question: In C++ Problem Statement : Design a PayRoll class as per the following: Data (Member Data) 1. employees hourly pay rate (HPR) 2. employees number

In C++

Problem Statement: Design a PayRoll class as per the following:

Data (Member Data)

1. employees hourly pay rate (HPR)

2. employees number of hours worked (NHW)

Operations (Member Functions)

1. Default constructor to set HPR to $10, NHW to 40 hours.

2. Non-default constructor with one parameter for HPR. Set NHW to 40 hours.

3. Another non-default constructor with one parameter for NHW. Set HPR to $10.

4. Yet another non-default contractor to accept both parameters.

5. Setter methods for both member variables. Include input validation such that negative numbers are not allowed. The values should be less than $20 for HPR and less than 60 for NHW. Allow the user to correct the mistakes for out of the range values. The input validations should be used in constructor whenever necessary.

6. Getter methods to retrieve the member variables. Make sure the getters dont change the variables values.

7. Getter method to calculate gross pay (HPR * NHW).

Write a program to create a dynamic array of PayRoll objects. The size of the array should be entered by the user. The program should ask the user for HPR and NHW of each employee and then display the amount of gross pay each has earned

The class definition should be in a PayRoll.h file, and the implementation should be in PayRoll.cpp file. The main function should be implemented in Prog.cpp file.

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!