Iplement the employee class and its three child classes


FRAMEWORK OF THE PROBLEM

Acme Corporation, a well-known international IT company, is developing a Java application to manage their human resources. Employees in the company belong to any of these three departments: management, engineering or administration, and may have different types of contracts: temporary, training or indefinite. The annual salary of each employee is calculated based on his/her department, type of contract and the number of years in the company.

The application consists in several Java files, described as follows.

First, the Employee class models a generic employee, which holds 4 attributes:
* name: the name of the employee, a String
* contract: the type of contract, an int (see below)
* years: number of years in the company, an int 
* department: department to which he/she belongs, a String

This class includes a constructor to initialize all the attributes and provides the access methods (getters and setters) for all of them. These access methods must check that only valid values are assigned; otherwise, an IllegalArgumentException with a descriptive message must be thrown.

Allowed values for the type of contract must be defined in three integers: TEMPORARY (0), TRAINING (1) and INDEFINITE (2). These constants must be used throughout the program instead of the specific integer values, for code reading purposes.

The Employee class must implement the following Employed interface, which includes one single method double getSalary() that returns the total salary of the employee:

public interface Employed {
double getSalary();
}

Finally the class must include a String toString() method that returns the description of the employee, in the following format:

: department, contract, years in the company, salary of bitcoins

[The text between < > represents the actual values for a given employee, for instance, indicates that the name of the employee must be printed]

Three classes, extending from Employee, model employees in each of the company departments.

1) The ManagementEmployee class represents an employee in the Management department. A manager always has an indefinite contract and his/her salary is based on a starting salary of 40 000 bitcoins plus 6 000 bitcoins for every year in the company. 

2) Similarly, the EngineeringEmployee class represents an employee in the Engineering department. The salary of an engineer starts with 25 000 bitcoins and is incremented in 2 500 bitcoins each complete year that he/she stays in the company.

3) Lastly, the AdministrationEmployee class represents an employee in the Administration department. These employees are hired from employment agencies, so his/her contracts are always temporary and count as 0 years in the company. The salary is fixed, 18 000 bitcoins.

The current staff is made up of 6 employees:

* Bill, manager, 9 years in the company.
* Anna, engineering department, 9 years in the company, indefinite contract.
* John, engineering department, 5 years in the company, indefinite contract.
* Elizabeth, engineering department, 3 years in the company, training contract. 
* Michael, engineering department, 2 years in the company, training contract.
* Albert, administration.

The goal of this activity is to:

A) Implement the Employee class and its three child classes (ManagementEmployee, EngineeringEmployee and AdministrationEmployee), with all the necessary attributes and methods. Do not include any other attribute or method apart from the ones previously described.

B) Write a Staff class, which first creates an array with all the employees in the company, and then prints the complete staff list on the screen. This class must also calculate and print the total salary for each of the three departments.

The expected output of the Staff class is as follows:

- Bill: Management department, indefinite contract, 9 years in the company, salary of 94000.0 bitcoins 
- Anna: Engineering department, indefinite contract, 9 years in the company, salary of 47500.0 bitcoins
- John: Engineering department, indefinite contract, 5 years in the company, salary of 37500.0 bitcoins
- Elizabeth: Engineering department, training contract, 3 years in the company, salary of 32500.0 bitcoins
- Michael: Engineering department, training contract, 2 years in the company, salary of 30000.0 bitcoins
- Albert: Administration department, temporary contract, 0 years in the company, salary of 18000.0 bitcoins

MANAGEMENT TOTAL SALARY: 94000.0 bitcoins
ENGINEERING TOTAL SALARY: 147500.0 bitcoins
ADMINISTRATION TOTAL SALARY: 18000.0 bitcoins
ACME TOTAL SALARY: 259500.0 bitcoins

Request for Solution File

Ask an Expert for Answer!!
JAVA Programming: Iplement the employee class and its three child classes
Reference No:- TGS01001855

Expected delivery within 24 Hours