Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

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

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

Oracle 11G SQL

Authors: Joan Casteel

2nd Edition

1133947360, 978-1133947363

More Books

Students also viewed these Databases questions