Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

using c++ Create an abstract base class Employee that has the following attributes: ID (member variable) First name (member variable) Last name (member variable) Count

using c++ Create an abstract base class Employee that has the following attributes:

  • ID (member variable)

  • First name (member variable)

  • Last name (member variable)

  • Count (static variable)

  • static function that would return the count.

  • pure virtual function that would return the employees salary.

Create 2 derived classes from class Employee

  1. SalariedEmployee which has the following additional attributes

  • Base Salary

  • Commission Rate

  • Gross Sales

  1. HourlyEmployee which has the following additional attributes

  • Hours

  • Rate.

*All classes should have setters and getters for their attributes along with any extra private/public functions you see needed.

You should write a program that creates a vector of pointers (in main) of type Employee that points to different objects of Salaried and Hourly Employees.

Use a do while loop to ask the user to enter the type of employee a character:

  • S for Salaried

  • H for Hourly

The user then enters the employees data and is prompted to enter another employee or not.

At the end, when the user decides not to enter any more employees, you should print the number of employees (using the static count function) and print out all the Employees info by their entry order along with their salary:

  • Salaried Employee Salary = Base Salary + Commision Rate * Gross sales

  • Hourly Employee Salary = Hours * Rate

Sample Run

H

H113 // ID of Hourly Employee

Ahmed // First name of Hourly Employee

Salem // Last name of Hourly Employee

50 // Hours of Hourly Employee

200 // Rate of Hourly Employee

Enter another?

y

S

S334 // // ID of Hourly Employee

Mona // First name of Salaried Employee

Mohammed // Last name of Salaried Employee

5000 // Base Salary of Salaried Employee

0.2 // Commission Rate of Salaried Employee

30000 // Gross Sales of Salaried Employee

Enter another?

y

H

H352 // ID of Hourly Employee

Omar // First name of Hourly Employee

Saleh // Last name of Hourly Employee

60 // Hours of Hourly Employee

300 // Rate of Hourly Employee

Enter another?

n

Output

Number of Employees : 3

Employee 1:

ID : H113

Name : Ahmed Salem

Salary : 10000

Employee 2:

ID : S334

Name: Mona Mohammed

Salary : 11000

Employee 3:

ID: H352

Name : Omar Saleh

Salary : 18000

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_2

Step: 3

blur-text-image_3

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

More Books

Students also viewed these Databases questions

Question

=+ 31-2 Discuss how psychologists describe the human memory system.

Answered: 1 week ago

Question

What is Accounting?

Answered: 1 week ago