0% found this document useful (0 votes)
96 views

Assignment - 3 Statement

1. The document outlines an assignment for an Object Oriented Programming course involving payroll calculations for different employee types using polymorphism. 2. Students are asked to modify an existing payroll system to include a birthdate variable for each Employee, and add a new PieceWorker employee type whose pay is based on pieces produced. 3. A loop is to calculate payroll polymorphically for each Employee in an array, adding a $100 bonus if their birthday is in the current month or if they are a BasePlusCommissionEmployee.

Uploaded by

every thing
Copyright
© © All Rights Reserved
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
96 views

Assignment - 3 Statement

1. The document outlines an assignment for an Object Oriented Programming course involving payroll calculations for different employee types using polymorphism. 2. Students are asked to modify an existing payroll system to include a birthdate variable for each Employee, and add a new PieceWorker employee type whose pay is based on pieces produced. 3. A loop is to calculate payroll polymorphically for each Employee in an array, adding a $100 bonus if their birthday is in the current month or if they are a BasePlusCommissionEmployee.

Uploaded by

every thing
Copyright
© © All Rights Reserved
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 3

COMSATS University Islamabad, Lahore Campus

Department of Computer Science

Assignment 3 – Semester Fall 2021


Course Title: Object Oriented Programming Course Code: CSC241 Credit Hours: 4(3,1)
Course Instructor/s: Mr. Imran latif Program Name: BSEE
rd
Semester: 3 Section: A, B Batch FA20-BSEE
Total Marks: 10 Obtained Marks: Date:
60 Minutes
Student’s Name: Obtain Reg. No.
Important Instruction:
ed
Marks:
• Student is himself/herself responsible for successful submission of assignment on CU-Online
• Your submission must include the following in a single pdf file.
1. Code of all classes
2. Snapshot of the output of submitted code.
• Copied assignment will get zero credit.
• Deadline: December 11, 2021 till 11:30 PM

Question 1:
Recall the concept of Inheritance, method overriding and polymorphism and write down the
code according to requirements.
Learning Outcome: PLO3→CLO3 (C3, C4, C5)
Question 1:

A company pays its employees on a weekly basis. 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 and salaried- commission
employees receive a base salary plus a percentage of their sales. For the current pay period,
the company has decided to reward salaried-commission employees by adding 10% to their
base salaries. The company wants to implement a Java application that performs its payroll
calculations polymorphically.
• Modify the above payroll system to include private instance variable birthDate in class
Employee. Add get methods to class Date. Assume that payroll is processed once per
month.
• Include an additional Employee subclass PieceWorker that represents an employee whose
pay is based on the number of pieces of merchandise produced. Class PieceWorker should
contain private instance variables wage (to store the employee’s wage per piece) and pieces
(to store the number of pieces produced). Provide a concrete implementation of method
earnings in class PieceWorker that calculates the employee’s earnings by multiplying the
number of pieces produced by the wage per piece. Create an array of Employee variables
to store references to the various employee objects. In a loop, for each Employee, display
its String representation and calculate the payroll for each Employee (polymorphically),
and add a $100.00 bonus to the person’s payroll amount if the current month is the one in
which the Employee’s birthday occurs or an employee object is of type
BasePlusCommissionEmployee

You might also like