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

Assignment 3 Statement

This document contains an assignment for an Object Oriented Programming course. It involves modifying a payroll system to include additional employee types and functionality. Specifically, it asks students to: 1. Add a private birthDate variable to the Employee class and get methods to the Date class. 2. Create a new PieceWorker employee subclass with variables for wage and pieces produced, and implement an earnings method. 3. Loop through an array of Employees, display their info, calculate payroll polymorphically, and add a $100 bonus if the month matches an employee's birthday or 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)
28 views

Assignment 3 Statement

This document contains an assignment for an Object Oriented Programming course. It involves modifying a payroll system to include additional employee types and functionality. Specifically, it asks students to: 1. Add a private birthDate variable to the Employee class and get methods to the Date class. 2. Create a new PieceWorker employee subclass with variables for wage and pieces produced, and implement an earnings method. 3. Loop through an array of Employees, display their info, calculate payroll polymorphically, and add a $100 bonus if the month matches an employee's birthday or 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/ 2

COMSATS University Islamabad, Lahore Campus

Department of EE

Assignment 3 – Semester Fall 2022


Course Title: Object Oriented Programming Course Code: CSC241 Credit Hours: 4(3,1)
Course Instructor/s: Ms. Mamoona Tasadduq Program Name: BEE
rd
Semester: 3 Section: B, C Batch FA21-BEE
Total Marks: 10 Obtained Marks: Date:
60 Minutes December 06, 2022
Student’s Name: Obtain Reg. No.
Important Instruction:
ed
Marks:
• Student is himself/herself responsible for successful submission of assignment on MS Teams
• 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 06, 2022, at 11:59 PM

Question 1:
Recall the concept of inheritance, polymorphism, and abstraction, and write down the code
according to requirements.
Learning Outcome: PLO3→CLO3

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