Question: Please use the JAVA language With Employee class Create a class to implement an ordered linked list of employees (increasing order of employee number), the

Please use the JAVA language

With Employee class

Create a class to implement an ordered linked list of employees (increasing order of employee number), the HumanResources class.

Inside the HumanResources class you, create a private class to define a node object. It will have two private data members, one member for an employee object and one for the address on the next node (i.e. the link). You may define one or more constructor for the node class.

The HumanResources class will have one private data member:

first which will be an object of the node class. It will store the reference (address) of the first node in the list.

The HumanResources class will include the following instance methods:

public HumanResources() Zero-parameter constructor to initialize an empty list.

public HumanResources(HumanResources) Copy constructor to create a new object (linked list) identical in content to the given parameter.

public boolean isEmpty() Method that returns true if the list is empty and false otherwise.

public boolean addEmployee(Employee) Method that inserts a new employee in the list (in increasing order of employee number). It returns true if the employee was added to the list. It returns false if the employee is already in the list (same employee number).

public boolean deleteEmployee(String) Method to delete the employee with the given employee number from the list. It returns true if the employee was deleted. It returns false if the employee was not in the list.

public Employee findEmployee(String) Method that returns an employee object if the employee with the given number is found in the list. It returns null otherwise.

public boolean changeDepartment(String, String) For the given employee (first parameter), this method changes the department value to the given department (second parameter). It returns true if the department was successfully changed (employee was present in the list); it returns false otherwise.

public boolean adjustSalary (String, double ) For the given employee (first parameter), this method adjuststhe salary value by adding the given amount (second parameter) to the existing salary; the amount given may be positive or negative. It returns true if the employee salary was adjusted; it returns false otherwise.

public String toString() Method that returns the content of the list, i.e. all the data for each employee on a separate line.

public String decreasingOrder() Method that returns the content of the list, i.e. all the data for each employee on a separate line but in decreasing order of employee number. The method should call a recursive method (private) to achieve this.

Important Notes:

You must code private method(s) to handle everything relating to the searching in the list to obtain the reference to the given node and the one before it.

The addEmployee, deleteEmployee and findEmployee method must use the private method(s) mentioned above. There should not be a loop in those three methods nor in the changeDepartment or adjustSalary methods.

You must code a private recursive method to set up the string with the employee data in decreasing order.

For efficiency reasons, the copy constructor should not call the addEmployee method to create the copy.

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!