Let's start by discussing the methods we will implement in our EmployeeRecords
class.
addProject(employeeId: String, projectName: String): Boolean
— This method adds a new project to an employee's list of projects. If the project already exists for that employee, the method returnsfalse
. Otherwise, it adds the project and returnstrue
.addTask(employeeId: String, projectName: String, task: String): Boolean
— This method adds a new task to a specified project for an employee. If the project does not exist for that employee, the method returnsfalse
. If the task is added successfully, it returnstrue
.getTasks(employeeId: String, projectName: String): List<String>?
— This method retrieves all tasks for a specified project of an employee. If the project does not exist for that employee, the method returnsnull
. Otherwise, it returns the list of tasks.
Let's build our EmployeeRecords
class step-by-step, ensuring we understand each component clearly.
