Write a Java library (use a package) to support a Company Directory. The Company
ID: 3858596 • Letter: W
Question
Write a Java library (use a package) to support a Company Directory. The Company Directory tracks the following information about a person:
First name
Last name
Telephone number
Email address
Employee Number (must be unique).
Get the person’s role (determined as Executive, Manager,
Worker).
Employees of the company fall into one of three categories:
1. Executives 2. Managers 3. Workers
Each worker is assigned to a specific department.
Each manager has a number of direct reports (e.g. directReports = 5).
Each executive has a number of managers that report to the executive and a number of indirect reports (workers) that he/she is responsible for (e.g. directReports = 2, indirectReports = 12).
The Company Directory should support the following operations:
1. Add Worker
2. Delete Worker (by employee number)
3. Add Executive
4. Delete Executive (by employee number)
5. Add Manager
6. Delete Manager (by employee number)
7. Print all Workers, sorted by “Last Name, First Name”
8. Print all Executives, sorted by “Last Name, First Name”
9. Print all Managers, sorted by “Last Name, First Name”
10. Print the entire company directory, sorted by “Last Name, First
Name”. The role of the person (Executive, Manager, Worker)
should be displayed for each person.
11. Add a new Worker, Executive, or Manager using an existing
Worker, Executive, or Manager object (clone).
12. Assume that you would like to read and write these objects
to a database. Executives can be read from a database but cannot be written. Managers can be written to a database but cannot be read from the database. Workers can be read from or written to a database. Make sure your program would be able to support this functionality.
You should use override toString(), implement Comparable, and implement Cloneable in your solution to solve this problem effectively.
Explanation / Answer
Hey,
Since you have provided a question with multiple subparts, I am answering first 6 of them. For other subparts please ask seperately. I have provided the code below. Do comment if you have any queries.
// Code starts here
// Code ends here
Hope it helps!
Related Questions
drjack9650@gmail.com
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.