Question
Write a program that contains two classes, one named Employee being a base class for all employees and a derived class named SalaryEmp whose objects
Write a program that contains two classes, one named Employee being a base class for all employees and a derived class named SalaryEmp whose objects will be salaried employees. Then instantiate class objects and generate an output, according to the requirements given below.
Information about This Project
This particular project uses the principles of inheritance.
Steps to Complete This Project
STEP 1 Implement Class Construction
First, construct a class named Employee whose data members include: two string members named empID and empName; two float members named hourlyRate and grossPay ; and one integer member named
hoursWorked . Declare all these data members as protected .
Also, include the following member functions in your class definition: a constructor that displays a message to the user indicating that an employee is being constructed; a void type function named Display() , which displays the employee record, as sampled below; a void type SetEmpID() function which sets the employee identification number; a
string type function named GetEmpID(), which returns the employee ID ; a void function named SetName() which sets the employees name; a string type function named GetName() which returns the employees name; a void type function SetHourlyRate() which sets the hourly rate; a float type function named GetHourlyRate() which returns the hourly rate; a void type function SetHoursWorked() which returns the hours worked and an integer type function named GetHoursWorked() which returns the hours worked; a float type function named
GetGrossPay() which returns the gross pay.
Declare all these base class function members as public . Prior to defining a derived class, inheritance test drive your class by instantiating an object in the main() program using the sample data below.
Employee Record | Hourly Wage Employee |
ID Number | 805 |
Name | Sammy Student |
Hours Worked | 38 |
Hourly Wage | $ 10.00 |
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started