Question: Question 1 : Write an Employee Class Design a class to represent an employee in a company. Each employee has a unique ID , a
Question : Write an Employee Class
Design a class to represent an employee in a company. Each employee has a unique ID a name, and an email address. Employees can be assigned to projects, with a maximum of three projects per employee. Each employee also has access to the company cafeteria but needs special permission to access the secure file room, which is granted if they are assigned to at least one project.
The Employee class should have the following public interface:
public Employee String name, String email: A constructor to set up the employee's name and email address. Use a static variable to help assign a unique ID to each employee object.
public String getName: An accessor to return the employee's name.
public String getEmail: An accessor to return the employee's email.
public int getEmployeeId: An accessor to return the employee's ID
public boolean assignProjectString projectName: A method to assign projects. If trying to add more than three projects, it returns false. Returns true if the project is successfully added.
public boolean removeProject String projectName: A method to remove a project from the employee's list. Returns false if no such project exists.
public int getProjectCount: A method to return the number of projects the employee is assigned.
public boolean hasCafeteriaAccess : Always returns true as all employees have cafeteria access.
public boolean hasFileRoomAccess: A method that returns true if the employee is assigned to at least one project.
Write a tester program TaskTester to test your Employee class thoroughly. Follow the examples given in class and create objects using the Employee class. Each public method should be tested at least once.
What to submit:
Submit the following source files ONLY: Employee.java, Person.java, Employeejava,
Manager.java. Do not submit class files, only java files. Do not submit TaskTester.java
and TaskTester.java
Marking Scheme:
Style: quad
JavaDoc Comments:
Code Compiles? yesno
Successful Execution of Test Cases:
Total: quad
Ensure your code compiles without an IDE and without any package statements.
Step by Step Solution
There are 3 Steps involved in it
1 Expert Approved Answer
Step: 1 Unlock
Question Has Been Solved by an Expert!
Get step-by-step solutions from verified subject matter experts
Step: 2 Unlock
Step: 3 Unlock
