QUESTION 4 (use c++ to answer the following question) Note: You need to add required constructors/destructors, member functions or data members/variables in your program to complete its execution. Suppose we are designing a record-keeping program that has records for salaried employees and hourly employees. There is a natural hierarchy for grouping these classes. These are all classes of people who share the property of being employees. Employees who are paid an hourly wage are one subset of employees. Another subset consists of employees who are paid a fixed wage each month or week. Although the program may not need any type corresponding to the set of all employees, thinking in terms of the more general concept of employees can be useful. For example, all employees have names, Social Security numbers (ssn) and net pay, and the member functions for setting and changing the name, ssn and netpay would be same for both hourly and salaried employees. Implement the above mentioned record keeping program by creating an Employee class with data members name, ssn, and netpay. Include the default and parameterized constructors, member functions to set and get the data members. Also, write a printCheck function that should display error message that “printCheck Function Called for an undifferentiated employee” Create HourlyEmployee class (inherit from Employee class) with data members wageRate and hours (think rationally about the data types). Include the default constructor, parameterized constructor, setter, getter and printCheck function. The printCheck function should display the following output: Pay to the order of John Blue The sum of 10000 Dollars Check Stub: NOT NEGOTIABLE Employee Number: Hourly Employee Hours Worked: hours Rate: Pay: Similarly, create SalariedEmployee, inherit from Employee class, with data member salary. Define the constructors, setter and getter methods and printCheck function. The printCheck function output should be as follows: _____________________________________________________________________ Pay to the order of John Blue The sum of 10000 Dollars Check Stub: NOT NEGOTIABLE Employee Number: Salaried Employee Regular Pay:
QUESTION 4 (use c++ to answer the following question)
-
Note: You need to add required constructors/destructors, member functions or data members/variables in your program to complete its execution.
Suppose we are designing a record-keeping program that has records for salaried
employees and hourly employees. There is a natural hierarchy for grouping these classes.
These are all classes of people who share the property of being employees.
Employees who are paid an hourly wage are one subset of employees. Another
subset consists of employees who are paid a fixed wage each month or week. Although the program may not need any type corresponding to the set of all employees, thinking in terms of the more general concept of employees can be useful. For example, all employees have names, Social Security numbers (ssn) and net pay, and the member functions for setting and changing the name, ssn and netpay would be same for both hourly and salaried employees.Implement the above mentioned record keeping program by creating an Employee class with data members name, ssn, and netpay. Include the default and parameterized constructors, member functions to set and get the data members. Also, write a printCheck function that should display error message that “printCheck Function Called for an undifferentiated employee”
Create HourlyEmployee class (inherit from Employee class) with data members wageRate and hours (think rationally about the data types). Include the default constructor, parameterized constructor, setter, getter and printCheck function. The printCheck function should display the following output:
Pay to the order of John Blue
The sum of 10000 Dollars
Check Stub: NOT NEGOTIABLE
Employee Number: <ssn>
Hourly Employee
Hours Worked: <hours> hours Rate: <wageRate> Pay: <netpay>
Similarly, create SalariedEmployee, inherit from Employee class, with data member salary. Define the constructors, setter and getter methods and printCheck function. The printCheck function output should be as follows:
_____________________________________________________________________
Pay to the order of John Blue
The sum of 10000 Dollars
Check Stub: NOT NEGOTIABLE
Employee Number: <ssn>
Salaried Employee
Regular Pay: <salary>
Trending now
This is a popular solution!
Step by step
Solved in 3 steps with 1 images