Professional Documents
Culture Documents
OOP Final QP
OOP Final QP
OOP Final QP
In main (), declare an array of ten objects of ForeignStudent class. Initialize array using loop through setters. You have to
display the details of those students who are female having GPA greater than 3.0 and belong to Scotland.
Page 1 of 2
Question 3: [10 Marks]
Write a program of polymorphism for Employee payroll system. There are three kind of Employees in the system:
Salaried_Employees
Hourly_Employees
Base_salary_plus_commission_Employees
Make Employee an abstract class. Declare Calculate_Salary() as pure virtual function in it which is used to calculate and
display salary of employee by child or concrete classes.
Salaried_Employees are paid a fixed monthly salary regardless of the number of hours worked. Salaried_Employees class
has salary data member.
Hourly_Employees are paid by their working hours and receive salary after multiplying number_of_hours with their
hour_rate. Hourly_Employees class has salary, hour_rate and number_of_hours data members.
Base_salary_plus_commission_Employees receive a base salary plus commission.
Base_salary_plus_commission_Emopoyees class has salary, No_of_item_sold and commission data members.
[Commission= No_of_item_sold *1000]
Employee
Base_salary_plus_commission
Salaried_Employees Hourly_Employees _Employees
In main(), take input in each class object and calculate the salary of each employee polymorphically.
Page 2 of 2