Design an Employee Management System

Easy
Real World SystemsCRUDHierarchyPayrollReportingOOP

Problem Statement

Design an employee management system for an organization — handling employee records, org hierarchy, department management, payroll calculations, and reporting.

Requirements

Functional Requirements

  • Employee profiles: id, name, email, department, designation, salary, joinDate, manager
  • Employee types: FULL_TIME, PART_TIME, CONTRACT — different payroll rules
  • Department management: create, update departments; assign employees
  • Org hierarchy: each employee has a manager (except CEO); traverse up the chain
  • Payroll: compute monthly salary considering type (full-time = fixed, part-time = hourly × hours, contract = daily rate × days)
  • Leave management: employees request leaves; manager approves/rejects; track leave balance
  • Reports: employee count per department, average salary per department, list by designation
  • Search employees by name, department, designation

Non-Functional Requirements

  • CRUD operations on employees and departments
  • Singleton EmployeeService

Key Entities

  • Employee: id, name, email, department, designation, employmentType, salary, managerId, joinDate
  • Department: id, name, head, employees
  • LeaveRequest: id, employee, type (SICK/CASUAL/ANNUAL), startDate, endDate, status
  • PayrollRecord: employeeId, month, grossAmount, deductions, netAmount
  • EmployeeService: Singleton

Constraints

  • Each employee has exactly one manager (except the top-level executive)
  • No circular management relationships
  • Leave balance: ANNUAL = 15 days/year, SICK = 12 days/year, CASUAL = 6 days/year
  • Payroll computed at month-end for all employees

!Constraints

- No circular manager relationships (DAG hierarchy) - Leave balance tracked annually and deducted on approval - Part-time payroll requires hours worked input; contract requires days worked - Department head must be an existing employee - Employee cannot be their own manager
Output

Run or submit your code to see output here.