Question: Create a simple Java application called Company that has the following classes: An Employee class that minimally stores the following data fields for an employee:
Create a simple Java application called Company that has the following classes:
An Employee class that minimally stores the following data fields for an employee:
Name
SSN
Phone number
Date of Birth
Start date
supervisorSSN
isSupervisor (Boolean type)
The following methods should also be provided:
A constructor that initializes the name and SSN
A constructor that initializes all fields
A method that returns the employees SSN
Methods to retrieve and update employees Name
Methods to retrieve and update employees phone number
Methods to retrieve and update employees Email
Methods to retrieve and update employees date of birth
Methods to retrieve and update employees start date
Methods to retrieve and update employees supervisors SSN
o When an employee is assigned to be a supervisor of another employee, make sure the supervisor has its isSupervisor field set as true. Otherwise, reject the update
Methods to retrieve and update employees supervisor condition (the employee himself/herself is/not a supervisor)
A method that determines if two employee objects are equal if their SSN are the same (override equals from the class Object)
A toString method prints a summary information of An employee A Supervisor class that minimally stores the following data fields for a supervisor:
Name
SSN The following methods should also be provided:
A constructor that initializes the name and SSN fields
Methods to retrieve the supervisors name
Methods to retrieve the supervisors SSN
A toString method prints a summary information of a supervisor A Company class that minimally stores the following data for a company:
Name of the company
Location of the company
Maximum number of employee
Maximum number of supervisors
Number of employee (current or existing)
Number of supervisors (current or existing)
A list contains information of existing employee (use an regular array Employee[ ] instead of ArrayList or other collection from Java Library)
A list contains information of current supervisor (use an regular array Supervisor[ ] instead of ArrayList or other collection from Java Library) The following methods should also be provided:
A constructor that initializes the name, location, and maximum number of employeemaximum number of supervisors using passed parameters (initial arrays with passed maximum capacity, make sure the maximum number of supervisor is no more than the maximum number of employee). Initialize other parameters if there is a need Method to print the list of current employee
Method to print the list of current supervisor
A method to search for an employee on the employee list; the search can be based on the employees name or SSN.
A method to add a new employee to the employee list. o If the list is full, report action failure. o If there is an existing employee with the same SSN on the employee list already, reject the insertion.
o If the employee is qualify to be added as a new member, generate a random number between [0, 1]. If the number is less than 0.5, set its supervisor field to true.
o Add the employee to supervisor list if it is set as an supervisor
A method to remove an employee from the list if the employee exists.
o Remove this employee from the supervisor list if he/she is also a supervisor
o Remove this employee from all employees supervisor list o If the target employee cannot be found, report action failure.
A toString method prints the company name, location and first few employees You may notice that the Employee and Supervisor classes described above have some relationship. Inheritance can be used here to improve the code reuse.
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
