Question: PROJECT DESCRIPTION Write a program that contains two classes, one named Employee being a base class for all employees and a derived class named SalaryEmp

 PROJECT DESCRIPTION Write a program that contains two classes, one namedEmployee being a base class for all employees and a derived class

PROJECT DESCRIPTION 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. 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 employee's name; a string type function named GetName() which returns the employee's 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 2 Implement Inheritance After you have tested your base class code, derive a class, through public derivation, called Salary Employee which has one float type private data member named annualSalary. The derived class has five member functions, which include: a derived class constructor, which display a message to the user that a salaried employee is being constructed; a float return type function named GetGrossPay() that returns the bi-weekly gross pay of a salaried employee, by dividing the annual salary divided by 26 payroll periods; a void return type function named Display() which displays the salaried employee record, as sampled below; a void function named SetAnnualSalary() which sets the annual salary of a derived class object; and a float return type function named GetAnnualSalary() which returns the employee's annual salary. Declare all these derived class function members as public. Test drive your class by instantiating a derived class object in the main() program using the sample data below. Employee Record Salaried Employee ID Number 837 Name Samantha Student Annual Salary $ 38,000.00 As an example of inheritance, examine the class definitions given below, which illustrate the inheritance of an Hourly Employee, instead of a Salaried Employee as required by this project. class Employee { protected: char name [size]; int number; public: Employee(); void getName(char the Name[]); int getNumber(); }; class HourlyEmp: public Employee { private: float wageRate; public: HourlyEmp(); float getWageRate() const; // use const so as not to change member values }

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!