Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

1. Demonstrate polymorphism in C++ If possible try to make each class and its subclasses in separate files while using polymorphism: (Employee.h, SalariedEmployee.h, HourlyEmployee.h, and

1. Demonstrate polymorphism in C++

If possible try to make each class and its subclasses in separate files while using polymorphism: (Employee.h, SalariedEmployee.h, HourlyEmployee.h, and ByPieceEmployee.h)

Also make a main.cpp file

a.Create 1 Employee class and 3 subclasses: SalariedEmployee, HourlyEmployee, and ByPieceEmployee.

b.Employee class has full name and hire date as private data members.

c.Each salaried employee has an annual salary; each hourly employee has wage per hour information; by-piece employees get paid by:

(number of pieces completed) * (rate-perpieces).

d.Create an array of 3 employee pointers, pointers to the base class. The first pointer will point to an object of SalariedEmployee; the second pointer will point to an object of HourlyEmployee and the third pointer will point to a ByPieceEmployee object.

e.Here is the information of these three employees:

f. We assume that this company has a 2 week pay cycle. Test the program with the following data sets, (2 sets).

(For salaried employee, it is 104,000 / 52 * 2 = 4000)

g.Create a virtual function in the base class named CalculatePayAmount(). Also create virtual functions in the three derived classes.

h.For Jose Feliciano, he gets a fixed pay every 2 weeks.

For Madison, the app will need to ask for total hours worked in the 2 weeks.

For Bruce Lee, the app will need to ask for number of pieces he completes within the 2 weeks period.

i.The employee base class should be abstract and the virtual function CalculatePayAmount should be pure.

j. (Required in this program)We need to implementdynamic bindingin this problem, (polymorphism).

NOTE: Show output of 2 runs (using the data sets in part f).

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access with AI-Powered 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

Survey of Accounting

Authors: Carl S Warren

5th Edition

9780538489737, 538749091, 538489731, 978-0538749091

Students also viewed these Programming questions

Question

=+Does the use of breakaway bases reduce the proportion of

Answered: 1 week ago