0% found this document useful (0 votes)
22 views7 pages

Document

This case study presents the development of an Employee Management System (EMS) in Java, utilizing object-oriented programming principles such as inheritance and encapsulation. The system manages employee data, organizes employees into departments, and supports various employee types like Manager and Developer. It includes a class structure for employees and departments, along with Java code examples demonstrating the system's functionality and output.

Uploaded by

gfujbiombvd
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
22 views7 pages

Document

This case study presents the development of an Employee Management System (EMS) in Java, utilizing object-oriented programming principles such as inheritance and encapsulation. The system manages employee data, organizes employees into departments, and supports various employee types like Manager and Developer. It includes a class structure for employees and departments, along with Java code examples demonstrating the system's functionality and output.

Uploaded by

gfujbiombvd
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 7

Case Study: Employee Management System in Java

1. Introduction

In modern organizations, managing employees and departments efficiently is vital for


smooth operations. This case study outlines the creation of an Employee Management
System (EMS) in Java using object-oriented programming (OOP) principles like inheritance,
encapsulation, and polymorphism.

2. Objective

To develop a Java-based system that:

Manages employee data (name, ID, position)

Organizes employees into departments

Supports different employee types like Manager and Developer

Displays employee hierarchy


3. Key Features

Add and assign employees to departments

Inherit employee types (Manager, Developer) from base Employee

Display structured department-wise employee listings

Hierarchical view (Manager > Developers)

4. Class Structure

Employee (Base Class)

├── Manager (Subclass)

└── Developer (Subclass)

Department

└── List of Employees


5. Java Programs

a) Employee.java

Public class Employee {

Protected int id;

Protected String name;

Protected String position;

Public Employee(int id, String name, String position) {

This.id = id;

This.name = name;

This.position = position;

Public void displayInfo() {

System.out.println(“ID: “ + id + “, Name: “ + name + “, Position: “ + position);

}
b) Manager.java

Public class Manager extends Employee {

Public Manager(int id, String name) {

Super(id, name, “Manager”);

Public void manageTeam() {

System.out.println(name + “ is managing the team.”);

c) Developer.java

Public class Developer extends Employee {

Public Developer(int id, String name) {

Super(id, name, “Developer”);

Public void writeCode() {

System.out.println(name + “ is writing code.”);

}
d) Department.java

Import java.util.*;

Public class Department {

Private String deptName;

Private List<Employee> employees;

Public Department(String deptName) {

This.deptName = deptName;

Employees = new ArrayList<>();

Public void addEmployee(Employee emp) {

Employees.add(emp);

Public void showDepartmentStructure() {

System.out.println(“\nDepartment: “ + deptName);

For (Employee emp : employees) {

Emp.displayInfo();

}
e) Main.java

Public class Main {

Public static void main(String[] args) {

// Create Employees

Manager m1 = new Manager(1, “Suvithra”);

Developer d1 = new Developer(2, “Rahul”);

Developer d2 = new Developer(3, “Karthik”);

// Create Departments

Department devDept = new Department(“Development”);

Department hrDept = new Department(“Human Resources”);

// Add Employees to Departments

devDept.addEmployee(m1);

devDept.addEmployee(d1);

devDept.addEmployee(d2);

// Display Structure

devDept.showDepartmentStructure();

// Demonstrate behavior

M1.manageTeam();

D1.writeCode();

D2.writeCode();

}
6. Output Example

Department: Development

ID: 1, Name: Suvithra, Position: Manager

ID: 2, Name: Rahul, Position: Developer

ID: 3, Name: Karthik, Position: Developer

Suvithra is managing the team.

Rahul is writing code.

Karthik is writing code.

7. Conclusion

This case study demonstrates how inheritance and class hierarchy in Java can be used to
build a modular and maintainable Employee Management System. It showcases OOP
principles and how to logically organize data and behavior for real-world scenarios like
employee-department management.

You might also like