Design Employee & Team Directory
Difficulty: MEDIUMCategory: LLDFrequency: 1Asked On 2025-06-24
Problem Statement
Design a system to manage an organization's employee directory and team structure. The system should support the following core functionalities:
1.Add Employee: Ability to add a new employee with attributes like name, ID, designation, and CTC.
2.Assign Manager: Assign a manager to an employee, creating a hierarchical reporting structure.
3.Add to Team: Add an employee to one or more teams. Each team may have a name, description, and a list of members.
4.View Hierarchy: Provide a hierarchical (tree-like) view of reporting structure starting from any given employee.
5.Calculate CTC: Calculate total CTC of an individual employee. Calculate cumulative CTC of all employees in a team. Optionally, calculate total CTC under a manager (including all direct and indirect reports).
Design the classes, interfaces, and relationships to support these features, ensuring scalability and clean separation of responsibilities.