Introduction where the different employees of the company

Introduction

In this assignment for payroll for Startup Company, we have to implement seven class where the different employees of the company are having different pay scale depending on their bonus vacation, income, and other factors. The first six class that define the categories of the employees working and these classes extend the functionality of their parent class Employee.

Requirements

The requirement of this program is that it must be able to create multiple employee objects that can be of different categories depending on the execution of the program at the user end. Also, the program must sort the employees by retirement in descending order of when the employee will retire. A second sorting is required to be done that sorts the employees based on their cost in descending order of their salary or value.

Other to complete the programs we need various instance variable to hold the data and act as a counter to increase the vacation taken. Those variables are:

Access type

Type

Variable name

Description

private

int

usedUnpaidVacation

keeps tracks of how much unpaid vacation has been used

private

int

usedVacation

keeps track of how much paid vacation has been

private

int

usedSickDays

keeps track of how many sick days have been used

private

int

numBonuses

Keeps track of how many commission based bonuses the employee received.

 

Design

The architectural design of the this program is very simple, there is one Employee class that is treated as the main class and the other six class are the subclass that extend the functionalities of the parent class and use its variables and override the parent class function according to their own suitable description given according to the assignment.

The payroll class is different it does not subclass from anything but is used to create the objects and the sort the employees by retirement and their cost. The sorting of the employee is done based on the use of comparator and an ArrayList. The employees are added to the ArrayList and then the comparator the class is used to sort the ArrayList depending on the particular variables as per as requirement.

Implementation

The first six class have simple implementation and extend the parent employee class. These classes have some fixed values like the bonus, leaves and the income with other special allowances. So these variables have final modifier and cannot be changed. Then there are private instance variable in the class, so getter and setter methods are used for them to assign and get the data. Also, there are increment functions that increase the value of these private instance variable by one.

There are two main function YTDValue which calculates the salary value of each different employee depending on the conditions. The next function is yearsTillRetirement that calculates the retirement years of the employee all have different conditions applied to them.

The payroll class is the one that creates the object array for the employees and the puts it into an array list and then sorts them in descending order for the retirement years and the value of the employee using the comparator class compare method. 

BACK TO TOP