Class EmployeeDatabase
- java.lang.Object
-
- EmployeeDatabase
-
public class EmployeeDatabase extends java.lang.Object
A class that implements a database of employees.This class models some functions of an employee database. We have two classes: EmployeeDatabase and Employee. You only need to finish functions in this class, however you would have to refer to the functions in the other class as well. And, of course, fix the checkstyle errors.
- See Also:
- Lab 10 Description
-
-
Constructor Summary
Constructors Constructor Description EmployeeDatabase()
Constructor which initializes the employees list.
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description int
countEmployeesUnder(Employee employee)
Count the number of employees under this manager.int
countManagersAbove(Employee employee)
Count the number of managers above this employee.Employee
findManager(Employee employee)
Returns the manager for the given employee.static void
main(java.lang.String[] unused)
Main method for testing.
-
-
-
Field Detail
-
employees
public java.util.List<Employee> employees
List of employees.
-
-
Method Detail
-
findManager
public Employee findManager(Employee employee)
Returns the manager for the given employee.- Parameters:
employee
- the employee to return the manager for- Returns:
- the employee's manager
-
countManagersAbove
public int countManagersAbove(Employee employee)
Count the number of managers above this employee.Consider both a recursive and an iterative solution to this problem.
- Parameters:
employee
- name of the employee- Returns:
- the number of manager's above this employee
-
countEmployeesUnder
public int countEmployeesUnder(Employee employee)
Count the number of employees under this manager.Consider both a recursive and an iterative solution to this problem.
- Parameters:
employee
- name of the employee- Returns:
- the number of employees under this manager
-
main
public static void main(java.lang.String[] unused)
Main method for testing.You should understand, but do not need to modify, this function.
- Parameters:
unused
- unused input arguments
-
-