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 1: 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 assignProject(String 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 Task1Tester 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, Employee2.java,
Manager.java. Do not submit .class files, only .java files. Do not submit Task1Tester.java
and Task2Tester.java
Marking Scheme:
Style: quad10
JavaDoc Comments: '10
Code Compiles? (yes/no)
Successful Execution of Test Cases: '80
Total: quad100
****Ensure your code compiles without an IDE and without any package statements.
Question 1 : Write an Employee Class Design a

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Programming Questions!