Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Use the following main(). int main() { CommissionedEmployee E1(25, 5000, 1000, 10); // CASE 1 - derived Class Pointer pointing to Derived class object CommissionedEmployee

image text in transcribed

Use the following main(). int main() { CommissionedEmployee E1(25, 5000, 1000, 10); // CASE 1 - derived Class Pointer pointing to Derived class object CommissionedEmployee * ptr; ptr = &E1; coutcalculateSalary(); coutcalculateSalary(); coutcalculateSalary(); cout Exercise 1: (10 points) We want to design a system for a company to calculate the salaries of its different types of employees. Consider the following diagram: Every employee has an employee ID and a basic salary. The Commissioned employee has a sales amount and rate. Hourly employee is paid on the basis of number of working hours. A regular employee may have a bonus. You have to implement all the above classes. Write constructor for all classes. The main functionality is to calculate salary for each employee which is calculated as follows: You have to define the following function in all classes: float calculateSalary ( and run the given main() for the following two cases: 1. when the calculateSalary( in base class is not virtual 2. when the calculateSalary( in base class is made virtual

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

Students also viewed these Databases questions