0% found this document useful (0 votes)
5 views3 pages

LabTest2 301

The document outlines the requirements for Lab Test 2 in the CST8132 Object-Oriented Programming course, which is due in Week 14 and is worth 20 marks. Students must create an Object-Oriented program using abstraction, encapsulation, polymorphism, and interfaces to manage a Payroll system with Contractor and Regular employee classes. The submission must include properly commented source code and a screenshot of the running program, with specific grading criteria provided for each component.

Uploaded by

osagies262
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
5 views3 pages

LabTest2 301

The document outlines the requirements for Lab Test 2 in the CST8132 Object-Oriented Programming course, which is due in Week 14 and is worth 20 marks. Students must create an Object-Oriented program using abstraction, encapsulation, polymorphism, and interfaces to manage a Payroll system with Contractor and Regular employee classes. The submission must include properly commented source code and a screenshot of the running program, with specific grading criteria provided for each component.

Uploaded by

osagies262
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
You are on page 1/ 3

CST8132 Object-Oriented Programming

Lab Test 2-Section 301


Due Date: Week 14 – in own lab hours
Marks: 20 marks (worth 10% of term mark)
Time: 90 Minutes

Requirement: Your code should be properly commented. As commenting the code is a


requirement, without comments, your submission will not be accepted and will end up with 0
marks.

Note: You can have only one Scanner object for this project, and that scanner should be closed
before the end of the program.

Write an Object-Oriented program incorporating abstraction, encapsulation, polymorphism and


interface that uses an array of Employee as an attribute of a Payroll object with each of the
following kinds of employees:

 Contractor
o firstName: to be read from the user
o lastName: to be read from the user
o hourly rate: to be read from the user
o hours per week: to be read from the user
o tax: 15% (that is, 0.15)
 Regular
o firstName: to be read from the user
o lastName: to be read from the user
o annual salary: to be read from the user
o deduction: 17% (that is, 0.17)

Write an interface Employee with an attribute that represents the name of the company and with
abstract methods to read details of an employee, process the payroll and to print the details.

Name of the company should be your name plus the word tech (Example: RejaulTech).

Also write Regular and Contractor classes that use Employee interface. These classes represent
regular and contractor employees.

The constructor for your Regular and Contractor classes will set the tax rate and deduction rate
accordingly. The method that reads details from the user will read details like employee’s name,
annual salary, hourly rate, hours per week etc. as required.

The method that does the payroll calculation should return the calculated amount. The print
method should get the return value of calculation method as a parameter.
Payroll class will have an array of Employee objects as its attributes. This class will do two
things:
1. add employees: Ask the user to enter the type of employee – Regular or Contractor. If the
user opts some other option other than Regular or Contractor, print an error message.
You need to repeat the process of reading the type of employee until you get a valid input
- Regular or Contractor. (See expected output). Read the details of the employee.
2. process payroll: This method will process the payroll for all employees and prints the
details.

PayrollTest class: In the main method, read from the user the number of employees in the
company. Then, create a Payroll object as required. With the created object, invoke methods for
adding employees and processing details.

Expected Output

To get marks, you need to define Employee interface, Contractor class, Regular class,
Payroll class and PayrollTest class.
Grading Scheme
Item Marks
Employee interface 2
Regular class 4
Contractor class 4
Payroll class 4
PayrollTest class 4
Comments (class header, provide comments wherever required) 2

Submission
Submit your source code (Employee.java, Regular.java, Contractor.java, Payroll.java and
PayrollTest.java) and the screenshot of the running program (LabTest.doc) during week 14 lab
hours in Brightspace.

You might also like