Answered step by step
Verified Expert Solution
Question
1 Approved Answer
how to write class EmployeeDatabase? 7. EmployeeDatabase: a list of all the employees and supervisors of the company as well as helpful methods. The type
how to write class EmployeeDatabase?
7. EmployeeDatabase: a list of all the employees and supervisors of the company as well as helpful methods. The type should only have a constructor that takes an int that is the maximum number of people that can be in the database and creates an empty array or arrays of an appropriate size to store the employees and supervisors. The type should have the following features that you will need to turn into one or more methods of the same, or slightly modified, names, as appropriate: 1. add: the add method(s) lets you add an employee or a supervisor object to the database. The object added should be the parameter to the method. The method should throw an EmployeeDatabaseFull exception if there are already the maximum number of allowed employees in the database. (You throw an exception using the throw Java command.) 2. remove(first name, last name, number) lets you remove an employee or a supervisor that matches the parameters first name, last name, and number. The object removed from the database should be returned by the method. A NoSuchEmployee exception should be thrown if no employee or supervisor matching the given name and number is in the database. 3. find (first name, last name, number) returns an employee or a supervisor object that matches the parameters first name, last name, and number. Throws a NoSuchEmployee exception if no employee or supervisor matching the parameter values exists in the database. 4. getPayrollAmount: returns the total amount that all employees and supervisors earned. 5. get.MaximumEarned: returns the employee or the supervisor who has the largest earnings in the database (break ties arbitrarily). Returns null if there are no emploees or supervisors in the database. 6. get.MinimumEarned: returns the employee or the supervisor who has the least earnings in the database (break ties arbitrarily). Returns null if there are no emploees or supervisors in the database. 7. get.MaxSales: returns the employee or the supervisor who has the largest number of sales (break ties arbitrarily). Throws a NoSuch Employee exception if there are no sales employees or sales supervisors in the database. 8. gerMinSales: returns the employee or the supervisor who has the least number of sales (break ties arbitrarily). Throws a NoSuchEmployee exception if there are no sales employees or sales supervisors in the database. 9. get.MaxHours Worked: returns the employee or the supervisor who worked the most hours (break ties arbitrarily). Throws a NoSuchEmployee exception if there are no hourly employees or hourly supervisors in the database. 10. get.MinHours Worked: returns the employee or the supervisor who worked the fewest hours (break ties arbitrarily). Throws a NoSuch Employee exception if there are no hourly employees or hourly supervisors in the database. 11. getSupervisees (supervisor): takes a supervisor object as input and returns an array that contains all the employee and supervisor objects that the parameter supervisor supervises. (The order of the objects in the array does not matter, but the length of the array should equal the total number of supervisees.) 7. EmployeeDatabase: a list of all the employees and supervisors of the company as well as helpful methods. The type should only have a constructor that takes an int that is the maximum number of people that can be in the database and creates an empty array or arrays of an appropriate size to store the employees and supervisors. The type should have the following features that you will need to turn into one or more methods of the same, or slightly modified, names, as appropriate: 1. add: the add method(s) lets you add an employee or a supervisor object to the database. The object added should be the parameter to the method. The method should throw an EmployeeDatabaseFull exception if there are already the maximum number of allowed employees in the database. (You throw an exception using the throw Java command.) 2. remove(first name, last name, number) lets you remove an employee or a supervisor that matches the parameters first name, last name, and number. The object removed from the database should be returned by the method. A NoSuchEmployee exception should be thrown if no employee or supervisor matching the given name and number is in the database. 3. find (first name, last name, number) returns an employee or a supervisor object that matches the parameters first name, last name, and number. Throws a NoSuchEmployee exception if no employee or supervisor matching the parameter values exists in the database. 4. getPayrollAmount: returns the total amount that all employees and supervisors earned. 5. get.MaximumEarned: returns the employee or the supervisor who has the largest earnings in the database (break ties arbitrarily). Returns null if there are no emploees or supervisors in the database. 6. get.MinimumEarned: returns the employee or the supervisor who has the least earnings in the database (break ties arbitrarily). Returns null if there are no emploees or supervisors in the database. 7. get.MaxSales: returns the employee or the supervisor who has the largest number of sales (break ties arbitrarily). Throws a NoSuch Employee exception if there are no sales employees or sales supervisors in the database. 8. gerMinSales: returns the employee or the supervisor who has the least number of sales (break ties arbitrarily). Throws a NoSuchEmployee exception if there are no sales employees or sales supervisors in the database. 9. get.MaxHours Worked: returns the employee or the supervisor who worked the most hours (break ties arbitrarily). Throws a NoSuchEmployee exception if there are no hourly employees or hourly supervisors in the database. 10. get.MinHours Worked: returns the employee or the supervisor who worked the fewest hours (break ties arbitrarily). Throws a NoSuch Employee exception if there are no hourly employees or hourly supervisors in the database. 11. getSupervisees (supervisor): takes a supervisor object as input and returns an array that contains all the employee and supervisor objects that the parameter supervisor supervises. (The order of the objects in the array does not matter, but the length of the array should equal the total number of supervisees.)Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started