Object Oriented Programming Techniques: Assignment # 2
Object Oriented Programming Techniques: Assignment # 2
Object Oriented Programming Techniques: Assignment # 2
Total Marks: 5
Obtained Marks:
Object Oriented
Programming Techniques
Assignment # 2
Last date of Submission: Wednesday, 23rd Dec, 2020
Student Name:
______________________________________________________________________________
Reg Number:
_______________________________________________________________________________
Question:
A company pays its employees weekly. The employees are of four types:
Salaried employees are paid a fixed weekly salary regardless of the number of hours
worked,
Hourly employees are paid by the hour and receive overtime pay for all hours worked in
excess of 40 hours,
Commission employees are paid a percentage of their sales
Base-salary-plus-commission employees receive a base salary plus a percentage of their
sales. For the current pay period, the company has decided to reward base-salary-plus-
commission employees by adding 10 percent to their base salaries.
Manager works to assign the salary to Salaried employees. Assign Basic salary and per
hour wages to hourly employees. Assign percentage to commission employees and assign
base salary, commission percentage and bonus to base-salary-plus-commission employees.
1. Base class Employee is an abstract class and it should include data members representing
the name, address and social security number (SSN). It also includes virtual functions
InsertData(), PrintEmployee( ) and destructor.
2. Salaried is virtually inherited from class Employee. It has a static data member Salary(as
it is common for all the salaried employees). Include a static function SetSalary( ) to set
salary value. Override functions of InsertData() and PrintEmployee( ). In PrintEmployee( )
function Before printing the employee data call CalculateSalary( ) function to calculate
salary.
3. Hourly is virtually inherited from class Employee. It has a static data member
OvertimeSalaryPerHour and a non static data member hours. Include a static function
SetOvertimeSalary( ) to set OvertimeSalaryPerHour value. Override functions of
InsertData(), CalculateSalary( ) and PrintEmployee( ). In PrintEmployee( ) function
Before printing the employee data call CalculateSalary( ) function to calculate salary.
4. Commission is virtually inherited from class Employee. It has a static data member
CommissionRatio and a non static data member Sales. Include a static function
SetCommissionRatio( ) to set perecentage of the commission in CommissionRatio.
Override functions of InsertData(), CalculateSalary( ) and PrintEmployee( ). In
PrintEmployee( ) function Before printing the employee data call CalculateSalary( )
function to calculate salary.