Program for Employee Management System
Last Updated :
02 Mar, 2023
A Employee’s Management System (EMS) is a software built to handle the primary housekeeping functions of a company. EMS help companies keep track of all the employees and their records. It is used to manage the company using computerized system.
Aim of Employee’s Management System:
- Built The Employee Table.
- Insert New Entries.
- Delete The Entries.
- Search A Record.
Data of the Employee's:
- Name
- Employee ID
- Designation
- Experience
- Age
Approach:
- For storing the data of the employee, create a user define datatype which will store the information regarding Employee. Below is the declaration of the data type:
struct employee {
string name;
long int code;
string designation;
int exp;
int age;
};
- Building the Employee's table: For building the employee table the idea is to use the array of the above struct datatype which will use to store the information regarding employee. For storing information at index i the data is stored as:
struct employee emp[10];
emp[i].name = "GeeksforGeeks"
emp[i].code = "12345"
emp[i].designation = "Organisation"
emp[i].exp = 10
emp[i].age = 10
- Deleting in the record: Since we are using array to store the data, therefore to delete the data at any index shift all the data at that index by 1 and delete the last data of the array by decreasing the size of array by 1.
- Searching in the record: For searching in the record based on any parameter, the idea is to traverse the data and if at any index the value parameters matches with the record stored, print all the information of that employee.
Below is the implementation of Employee Management system in C:
C++
// C++ program for the above approach
#include <bits/stdc++.h>
#define max 20
using namespace std;
// Structure of Employee
struct employee {
string name;
long int code;
string designation;
int exp;
int age;
};
int num;
void showMenu();
// Array of Employees to store the
// data in the form of the Structure
// of the Array
employee emp[max], tempemp[max],
sortemp[max], sortemp1[max];
// Function to build the given datatype
void build()
{
cout << "Build The Table\n";
cout << "Maximum Entries can be "
<< max << "\n";
cout << "Enter the number of "
<< "Entries required";
cin >> num;
if (num > 20) {
cout << "Maximum number of "
<< "Entries are 20\n";
num = 20;
}
cout << "Enter the following data:\n";
for (int i = 0; i < num; i++) {
cout << "Name ";
cin >> emp[i].name;
cout << "Employee ID ";
cin >> emp[i].code;
cout << "Designation ";
cin >> emp[i].designation;
cout << "Experience ";
cin >> emp[i].exp;
cout << "Age ";
cin >> emp[i].age;
}
showMenu();
}
// Function to insert the data into
// given data type
void insert()
{
if (num < max) {
int i = num;
num++;
cout << "Enter the information "
<< "of the Employee\n";
cout << "Name ";
cin >> emp[i].name;
cout << "Employee ID ";
cin >> emp[i].code;
cout << "Designation ";
cin >> emp[i].designation;
cout << "Experience ";
cin >> emp[i].exp;
cout << "Age ";
cin >> emp[i].age;
}
else {
cout << "Employee Table Full\n";
}
showMenu();
}
// Function to delete record at index i
void deleteIndex(int i)
{
for (int j = i; j < num - 1; j++) {
emp[j].name = emp[j + 1].name;
emp[j].code = emp[j + 1].code;
emp[j].designation
= emp[j + 1].designation;
emp[j].exp = emp[j + 1].exp;
emp[j].age = emp[j + 1].age;
}
return;
}
// Function to delete record
void deleteRecord()
{
cout << "Enter the Employee ID "
<< "to Delete Record";
int code;
cin >> code;
for (int i = 0; i < num; i++) {
if (emp[i].code == code) {
deleteIndex(i);
num--;
break;
}
}
showMenu();
}
void searchRecord()
{
cout << "Enter the Employee"
<< " ID to Search Record";
int code;
cin >> code;
for (int i = 0; i < num; i++) {
// If the data is found
if (emp[i].code == code) {
cout << "Name "
<< emp[i].name << "\n";
cout << "Employee ID "
<< emp[i].code << "\n";
cout << "Designation "
<< emp[i].designation << "\n";
cout << "Experience "
<< emp[i].exp << "\n";
cout << "Age "
<< emp[i].age << "\n";
break;
}
}
showMenu();
}
// Function to show menu
void showMenu()
{
cout << "-------------------------"
<< "GeeksforGeeks Employee"
<< " Management System"
<< "-------------------------\n\n";
cout << "Available Options:\n\n";
cout << "Build Table (1)\n";
cout << "Insert New Entry (2)\n";
cout << "Delete Entry (3)\n";
cout << "Search a Record (4)\n";
cout << "Exit (5)\n";
int option;
// Input Options
cin >> option;
// Call function on the basis of the
// above option
if (option == 1) {
build();
}
else if (option == 2) {
insert();
}
else if (option == 3) {
deleteRecord();
}
else if (option == 4) {
searchRecord();
}
else if (option == 5) {
return;
}
else {
cout << "Expected Options"
<< " are 1/2/3/4/5";
showMenu();
}
}
// Driver Code
int main()
{
showMenu();
return 0;
}
Java
/*package whatever //do not write package name here */
import java.util.*;
class GFG {
// Class of Employee
static class employee{
String name;
long code;
String designation;
int exp;
int age;
}
static int num;
static int max = 20;
// Array of Employees to store the
// data in the form of the Structure
// of the Array
static employee emp[] = new employee[max];
static employee tempemp[] = new employee[max];
static employee sortemp[] = new employee[max];
static employee sortemp1[] = new employee[max];
static Scanner sc = new Scanner(System.in);
// Function to build the given datatype
static void build()
{
System.out.println("Build The Table\n");
System.out.println("Maximum Entries can be " + max);
System.out.println("Enter the number of " + "Entries required");
num = sc.nextInt();
if (num > 20) {
System.out.println("Maximum number of "+"Entries are 20");
num = 20;
}
System.out.println("Enter the following data:");
for (int i = 0; i < num; i++) {
System.out.print("Name ");
emp[i].name = sc.next();
System.out.print("Employee ID ");
emp[i].code = sc.nextLong();
System.out.print("Designation ");
emp[i].designation = sc.next();
System.out.print("Experience ");
emp[i].exp = sc.nextInt();
System.out.print("Age ");
emp[i].age = sc.nextInt();
}
showMenu();
}
// Function to insert the data into
// given data type
static void insert()
{
if (num < max) {
int i = num;
num++;
System.out.print("Enter the information " + "of the Employee");
System.out.print("Name ");
emp[i].name = sc.next();
System.out.print("Employee ID ");
emp[i].code = sc.nextLong();
System.out.print("Designation ");
emp[i].designation = sc.next();
System.out.print("Experience ");
emp[i].exp = sc.nextInt();
System.out.print("Age ");
emp[i].age = sc.nextInt();
}
else {
System.out.println("Employee Table Full");
}
showMenu();
}
// Function to delete record at index i
static void deleteIndex(int i)
{
for (int j = i; j < num - 1; j++) {
emp[j].name = emp[j + 1].name;
emp[j].code = emp[j + 1].code;
emp[j].designation = emp[j + 1].designation;
emp[j].exp = emp[j + 1].exp;
emp[j].age = emp[j + 1].age;
}
return;
}
// Function to delete record
static void deleteRecord()
{
System.out.println("Enter the Employee ID "+ "to Delete Record");
int code = sc.nextInt();
for (int i = 0; i < num; i++) {
if (emp[i].code == code) {
deleteIndex(i);
num--;
break;
}
}
showMenu();
}
static void searchRecord()
{
System.out.println("Enter the Employee"+" ID to Search Record");
int code = sc.nextInt();
for (int i = 0; i < num; i++) {
// If the data is found
if (emp[i].code == code) {
System.out.println("Name " + emp[i].name);
System.out.println("Employee ID " + emp[i].code);
System.out.println("Designation " + emp[i].designation);
System.out.println("Experience " + emp[i].exp);
System.out.println("Age " + emp[i].age);
break;
}
}
showMenu();
}
// Function to show menu
static void showMenu()
{
System.out.println("-------------------------"
+ "GeeksforGeeks Employee"
+ " Management System"
+ "-------------------------\n");
System.out.println("Available Options:\n");
System.out.print("Build Table (1)\n");
System.out.print("Insert New Entry (2)\n");
System.out.print("Delete Entry (3)\n");
System.out.print("Search a Record (4)\n");
System.out.print("Exit (5)\n");
int option = sc.nextInt();
// Input Options
// Call function on the basis of the
// above option
if (option == 1) {
build();
}
else if (option == 2) {
insert();
}
else if (option == 3) {
deleteRecord();
}
else if (option == 4) {
searchRecord();
}
else if (option == 5) {
return;
}
else {
System.out.println("Expected Options" + " are 1/2/3/4/5");
showMenu();
}
}
public static void main (String[] args) {
showMenu();
}
}
// This code is contributed by aadityaburujwale.
Python3
max = 20
# Structure of Employee
class employee:
def __init__(self):
self.name = ''
self.code = 0
self.designation = ''
self.exp = 0
self.age = 0
num = 0
emp = [employee() for i in range(max)]
tempemp = [employee() for i in range(max)]
sortemp = [employee() for i in range(max)]
sortemp1 = [employee() for i in range(max)]
# Function to build the given datatype
def build():
global num, emp
print("Build The Table")
print("Maximum Entries can be", max)
num = int(input("Enter the number of Entries required: "))
if num > max:
print("Maximum number of Entries are 20")
num = 20
print("Enter the following data:")
for i in range(num):
emp[i].name = input("Name: ")
emp[i].code = int(input("Employee ID: "))
emp[i].designation = input("Designation: ")
emp[i].exp = int(input("Experience: "))
emp[i].age = int(input("Age: "))
showMenu()
# Function to insert the data into
# given data type
def insert():
global num, emp
if num < max:
i = num
num += 1
print("Enter the information of the Employee:")
emp[i].name = input("Name: ")
emp[i].code = int(input("Employee ID: "))
emp[i].designation = input("Designation: ")
emp[i].exp = int(input("Experience: "))
emp[i].age = int(input("Age: "))
else:
print("Employee Table Full")
showMenu()
# Function to delete record at index i
def deleteIndex(i):
global num, emp
for j in range(i, num - 1):
emp[j].name = emp[j + 1].name
emp[j].code = emp[j + 1].code
emp[j].designation = emp[j + 1].designation
emp[j].exp = emp[j + 1].exp
emp[j].age = emp[j + 1].age
# Function to delete record
def deleteRecord():
global num, emp
code = int(input("Enter the Employee ID to Delete Record: "))
for i in range(num):
if emp[i].code == code:
deleteIndex(i)
num -= 1
break
showMenu()
def searchRecord():
global num, emp
code = int(input("Enter the Employee ID to Search Record: "))
for i in range(num):
# If the data is found
if emp[i].code == code:
print("Name:", emp[i].name)
print("Employee ID:", emp[i].code)
print("Designation:", emp[i].designation)
print("Experience:", emp[i].exp)
print("Age:", emp[i].age)
break
showMenu()
# Function to show menu
def showMenu():
print("-------------------------GeeksforGeeks Employee Management System-------------------------\n")
print("Available Options:\n")
print("Build Table (1)")
print("Insert New Entry (2)")
print("Delete Entry (3)")
print("Search a Record (4)")
print("Exit (5)")
# Input Options
option = int(input())
# Call
if option == 1:
build()
elif option == 2 :
insert()
elif option == 3 :
deleteRecord()
elif option == 4 :
searchRecord()
elif option == 5 :
return
else:
print("Expected Options")
print("are 1/2/3/4/5")
showMenu()
# Driver code
showMenu()
C#
using System;
using System.Collections.Generic;
public class GFG{
// Class of Employee
static class employee{
public string name;
public long code;
public string designation;
public int exp;
public int age;
}
static int num;
static int max = 20;
// Array of Employees to store the
// data in the form of the Structure
// of the Array
static employee[] emp = new employee[max];
static employee[] tempemp = new employee[max];
static employee[] sortemp = new employee[max];
static employee[] sortemp1 = new employee[max];
static Scanner sc = new Scanner(System.in);
// Function to build the given datatype
static void build()
{
Console.WriteLine("Build The Table\n");
Console.WriteLine("Maximum Entries can be " + max);
Console.WriteLine("Enter the number of " + "Entries required");
num = sc.nextInt();
if (num > 20) {
Console.WriteLine("Maximum number of "+"Entries are 20");
num = 20;
}
Console.WriteLine("Enter the following data:");
for (int i = 0; i < num; i++) {
Console.Write("Name ");
emp[i].name = sc.next();
Console.Write("Employee ID ");
emp[i].code = sc.nextLong();
Console.Write("Designation ");
emp[i].designation = sc.next();
Console.Write("Experience ");
emp[i].exp = sc.nextInt();
Console.Write("Age ");
emp[i].age = sc.nextInt();
}
showMenu();
}
// Function to insert the data into
// given data type
static void insert()
{
if (num < max) {
int i = num;
num++;
Console.Write("Enter the information " + "of the Employee");
Console.Write("Name ");
emp[i].name = sc.next();
Console.Write("Employee ID ");
emp[i].code = sc.nextLong();
Console.Write("Designation ");
emp[i].designation = sc.next();
Console.Write("Experience ");
emp[i].exp = sc.nextInt();
Console.Write("Age ");
emp[i].age = sc.nextInt();
}
else {
Console.WriteLine("Employee Table Full");
}
showMenu();
}
// Function to delete record at index i
static void deleteIndex(int i)
{
for (int j = i; j < num - 1; j++) {
emp[j].name = emp[j + 1].name;
emp[j].code = emp[j + 1].code;
emp[j].designation = emp[j + 1].designation;
emp[j].exp = emp[j + 1].exp;
emp[j].age = emp[j + 1].age;
}
return;
}
// Function to delete record
static void deleteRecord()
{
Console.WriteLine("Enter the Employee ID "+ "to Delete Record");
int code = sc.nextInt();
for (int i = 0; i < num; i++) {
if (emp[i].code == code) {
deleteIndex(i);
num--;
break;
}
}
showMenu();
}
static void searchRecord()
{
Console.WriteLine("Enter the Employee"+" ID to Search Record");
int code = sc.nextInt();
for (int i = 0; i < num; i++) {
// If the data is found
if (emp[i].code == code) {
Console.WriteLine("Name " + emp[i].name);
Console.WriteLine("Employee ID " + emp[i].code);
Console.WriteLine("Designation " + emp[i].designation);
Console.WriteLine("Experience " + emp[i].exp);
Console.WriteLine("Age " + emp[i].age);
break;
}
}
showMenu();
}
// Function to show menu
static void showMenu()
{
Console.WriteLine("-------------------------"
+ "GeeksforGeeks Employee"
+ " Management System"
+ "-------------------------\n");
Console.WriteLine("Available Options:\n");
Console.Write("Build Table (1)\n");
Console.Write("Insert New Entry (2)\n");
Console.Write("Delete Entry (3)\n");
Console.Write("Search a Record (4)\n");
Console.Write("Exit (5)\n");
int option = sc.nextInt();
// Input Options
// Call function on the basis of the
// above option
if (option == 1) {
build();
}
else if (option == 2) {
insert();
}
else if (option == 3) {
deleteRecord();
}
else if (option == 4) {
searchRecord();
}
else if (option == 5) {
return;
}
else {
Console.WriteLine("Expected Options" + " are 1/2/3/4/5");
showMenu();
}
}
static public void Main (){
showMenu();
}
}
// This code is contributed by akashish__
JavaScript
// JavaScript program for the above approach
const max = 20;
// Structure of Employee
const employee = {
name: "",
code: 0,
designation: "",
exp: 0,
age: 0
};
let num;
// Array of Employees to store the
// data in the form of the Structure
// of the Array
let emp = new Array(max);
let tempemp = new Array(max);
let sortemp = new Array(max);
let sortemp1 = new Array(max);
// Function to build the given datatype
function build () {
console.log("Build The Table");
console.log("Maximum Entries can be " + max);
console.log("Enter the number of Entries required");
num = prompt();
if (num > 20) {
console.log("Maximum number of Entries are 20");
num = 20;
}
console.log("Enter the following data:");
for (let i = 0; i < num; i++) {
console.log("Name ");
emp[i].name = prompt();
console.log("Employee ID ");
emp[i].code = prompt();
console.log("Designation ");
emp[i].designation = prompt();
console.log("Experience ");
emp[i].exp = prompt();
console.log("Age ");
emp[i].age = prompt();
}
showMenu();
}
// Function to insert the data into
// given data type
function insert() {
if (num < max) {
let i = num;
num++;
console.log("Enter the information of the Employee");
console.log("Name ");
emp[i].name = prompt();
console.log("Employee ID ");
emp[i].code = prompt();
console.log("Designation ");
emp[i].designation = prompt();
console.log("Experience ");
emp[i].exp = prompt();
console.log("Age ");
emp[i].age = prompt();
}
else {
console.log("Employee Table Full");
}
showMenu();
}
// Function to delete record at index i
function deleteIndex (i) {
for (let j = i; j < num - 1; j++) {
emp[j].name = emp[j + 1].name;
emp[j].code = emp[j + 1].code;
emp[j].designation = emp[j + 1].designation;
emp[j].exp = emp[j + 1].exp;
emp[j].age = emp[j + 1].age;
}
return;
}
// Function to delete record
function deleteRecord() {
console.log("Enter the Employee ID to Delete Record");
let code = prompt();
for (let i = 0; i < num; i++) {
if (emp[i].code == code) {
deleteIndex(i);
num--;
break;
}
}
showMenu();
}
function searchRecord() {
console.log("Enter the Employee ID to Search Record");
let code = prompt();
for (let i = 0; i < num; i++) {
// If the data is found
if (emp[i].code == code) {
console.log("Name " + emp[i].name);
console.log("Employee ID " + emp[i].code);
console.log("Designation " + emp[i].designation);
console.log("Experience " + emp[i].exp);
console.log("Age " + emp[i].age);
break;
}
}
showMenu();
}
// Function to show menu
function showMenu() {
console.log("-------------------------" +
"GeeksforGeeks Employee" +
" Management System" +
"-------------------------\n\n");
console.log("Available Options:\n\n");
console.log("Build Table (1)\n");
console.log("Insert New Entry (2)\n");
console.log("Delete Entry (3)\n");
console.log("Search a Record (4)\n");
console.log("Exit (5)\n");
let option = prompt();
// Call function on the basis of the
// above option
if (option == 1) {
build();
} else if (option == 2) {
insert();
} else if (option == 3) {
deleteRecord();
} else if (option == 4) {
searchRecord();
} else if (option == 5) {
return;
} else {
console.log("Expected Options are 1/2/3/4/5");
showMenu();
}
}
// Driver Code
function main() {
showMenu();
return 0;
}
// This code is contributed by akashish__
Output: Below is the output of the above program: 
Similar Reads
Top 25 C Projects with Source Codes for 2025 Ready to improve your C programming skills? youâre in the right place! This article is packed with C project ideas for all skill levels whether youâre a beginner, intermediate learner, or looking for advanced challenges. Working on these projects will not only boost your programming skills but also
12 min read
Rock Paper Scissor in C Rock Paper Scissor (which is also called Stone Paper Scissor) is a hand game and played between two people, in which each player simultaneously forms one of three shapes. The winner of the game is decided as per the below rules: Rock vs Paper -> Paper wins.Rock vs Scissor -> Rock wins.Paper vs
4 min read
Hangman Game in C Hangman game is a popular and simple game in which the player has to guess the word based on the given hint. In this article, we will write a program for the hangman game using C programming language. What is the Hangman Game? Hangman is a word puzzle game that involves: A secret word: A word is sel
6 min read
C Program to Make a Simple Calculator A simple calculator is a program that can perform addition, subtraction, multiplication, and division of two numbers provided as input. In this article, we will learn to create a simple calculator program in C.ExampleInput: a = 10, b = 5, op = +Output: 15.00Explanation: Chosen operation is addition,
3 min read
Snake and Ladder Game in C Snake and Ladder game is a traditional game that involves two or more players and the winner is the guy who reaches the final square on the game board at the earliest. Components of the GameA square board with a series of numbered squares arranged in m x m grid.A dice to be rolled usually uses a six
5 min read
Bank account system in C using File handling This article focuses on how to create a bank account system using C language and File handling in C. Approach:Let's discuss the approach in detail, covering all the functions and their explanation in detail- Create a Menu in the main function and create different functions for the Menu, which will b
12 min read
Student Information Management System Prerequisites: Switch Case in C/C++ Problem Statement: Write a program to build a simple Software for Student Information Management System which can perform the following operations: Store the First name of the student.Store the Last name of the student.Store the unique Roll number for every studen
14 min read
E -Library Management System In this article, we will discuss the approach to creating an E-Library Management System where the user has the following options: Add book information.Display book information.To list all books of a given author.To list the count of books in the library. E -Library Management System Functionalities
10 min read
Program for Employee Management System A Employeeâs Management System (EMS) is a software built to handle the primary housekeeping functions of a company. EMS help companies keep track of all the employees and their records. It is used to manage the company using computerized system. Aim of Employeeâs Management System: Built The Employe
14 min read
Hospital Management System in C A Hospital Management System is software that facilitates its users some basic operations that take place in a typical hospital. This Hospital Management System in C language is a project for Hospitals having the following functionalities: Printing Hospital DataPrint Patients DataSort by Bed PriceSo
10 min read