0% found this document useful (0 votes)
36 views2 pages

Practice Q 02

The document outlines a mid-exam project for a payroll management system for a company in Bangladesh, requiring the use of object-oriented programming principles. It specifies the creation of two packages for employee and department classes, implementing inheritance and encapsulation, and includes detailed requirements for employee salary calculations. The final output includes employee details and total salary expenditures for the HR department.
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
36 views2 pages

Practice Q 02

The document outlines a mid-exam project for a payroll management system for a company in Bangladesh, requiring the use of object-oriented programming principles. It specifies the creation of two packages for employee and department classes, implementing inheritance and encapsulation, and includes detailed requirements for employee salary calculations. The final output includes employee details and total salary expenditures for the HR department.
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 2

United International University

Department of Computer Science and Engineering, Fall 24


CSE 1116: Object Oriented Programming Lab ​
Mid Exam - Total Marks: 20 - Time: 1 hour

You need to answer every question



Payroll Management System​
You are tasked to build a payroll management system for a company in Bangladesh. The system
should securely handle employee details, calculate their monthly salaries, and manage
departments.

Requirements:

●​ Use two packages:


1.​ employees (for employee-related classes).
2.​ departments (for department-related classes).
●​ Implement inheritance to differentiate between employee types.
●​ Secure sensitive data using encapsulation.

Classes:

1.​ Package: employees


➥​ Employee (Base Class):
■​ Attributes: name, id, basicSalary.
■​ Methods: calculateSalary() .
➥​ RegularEmployee (Subclass): Includes houseRent (20% of basicSalary) and
medicalAllowance (15% of basicSalary). calculateSalary() to compute total
salary.
2.​ Package: departments
➥​ Department:
■​ Attributes: departmentName, employeeList (array of Employee objects).
■​ Methods: addEmployee(Employee) and showEmployees().
➥​ HRDepartment: Subclass of Department. Includes a method to calculate the total
salary expenditure of the department.
3.​ Main Class (outside packages):
➥​ Create two departments: IT and HR.
➥​ Add employees:
■​ Tanvir Hossain (ID: 101, RegularEmployee, Basic Salary: 30,000 BDT, in
IT).
■​ Sharmin Akter (ID: 102, RegularEmployee, Basic Salary: 35,000 BDT, in
HR).
➥​ Display the details of employees in each department.
➥​ Show the total salary expenditure for HR.

Test Case:

1.​ Setup:
➥​ Create two departments:
■​ IT Department
■​ HR Department
2.​ Add Employees:
➥​ IT Department:
■​ Tanvir Hossain
■​ ID: 101
■​ Basic Salary: 30,000 BDT
➥​ HR Department:
■​ Sharmin Akter
■​ ID: 102
■​ Basic Salary: 35,000 BDT
3.​ Calculations:
➥​ Tanvir's Total Salary Calculation (IT Department):
■​ House Rent = 20% of 30,000 = 6,000 BDT
■​ Medical Allowance = 15% of 30,000 = 4,500 BDT
■​ Total Salary = Basic Salary + House Rent + Medical Allowance ​
​ = 30,000 + 6,000 + 4,500 = 39,000 BDT
➥​ Sharmin's Total Salary Calculation (HR Department):
■​ House Rent = 20% of 35,000 = 7,000 BDT
■​ Medical Allowance = 15% of 35,000 = 5,250 BDT
■​ Total Salary = Basic Salary + House Rent + Medical Allowance ​ ​
​ = 35,000 + 7,000 + 5,250 = 45,250 BDT

Final Output

Department: IT​
1. Name: Tanvir Hossain, ID: 101, Total Salary: 39,000 BDT

Department: HR​
Name: Sharmin Akter, ID: 102, Total Salary: 45,500 BDT

Total Salary Expenditure of HR: 45,500 BDT

You might also like