Coders Packet

Employee Management System using C++

By Shivaani Mathan Kandasamy

In this program, you can add up to 100 Employee Details to the system and can view their details by searching them using their Employee ID. You can Calculate Gross Pay, Net Pay of the Employee.

This is a simple program for beginners who wants to learn about Structures.

First, the input details of the employee are initialized using Structures. In the main function, the limit of the number of Employees is set to 100. Then the basic details are entered as input .

Finally, the details of the Employee are viewed by entering the Employee ID.

If statements are used to search the employee id. If the employee id is present the details of the employee are listed. If there is no such employee is present then an error message prompts and you can again search for an employee with the correct employee id.

In this program, you can also calculate the gross pay and net pay of the employee and can be viewed in the Employee Details.

 

Key Features of the Program

1. Uses Structures.
2. Can enter up to 100 Employee Details into the Record.
3. Search the Employee details using employee ID.
4. Calculate Gross Pay and Net Pay of Employee.

 

SOURCE CODE

#include
using namespace std;
struct employee                       // Initializing Structure named employee
{
    int emp_id;
    char name[50];
    float basic_pay, da, hra, pf, it, gross_pay, net_pay;
};
int main()                            // Main Function
{
    employee e[100];
    int i, l, n[50], a, flag;
    char ch;
    cout<<"\n Enter the number of Employee Details to be added in database 1-100 ";
    cin>>l;
    for (i=0;i<l;i++)
    {
    cout<<"\n Enter your Name :  ";
    cin>>e[i].name;
    cout<<"\n Enter your Employee id number :  ";
    cin>>e[i].emp_id;
    cout<<"\n Enter your Basic Pay : ";
    cin>>e[i].basic_pay;
    cout<<"\n Enter your Dearness Allowance (DA) Amount : ";
    cin>>e[i].da;
    cout<<"\n Enter your House Rent Allowance (HRA) Amount : ";
    cin>>e[i].hra;
    cout<<"\n Enter your Provident Fund (PF) Amount : ";
    cin>>e[i].pf;
    cout<<"\n Enter your Income Tax (IT) % : ";
    cin>>e[i].it; 
    e[i].gross_pay = e[i].basic_pay + e[i].hra + e[i].da;
    e[i].net_pay = e[i].gross_pay - (e[i].pf + e[i].it);
    }
    cout<<"\n----------------------------------------------------------------------------------------------------------------------------";
    cout<<"\n\t\t\t\t    UNICORN SOFTWARE SOLUTIONS PRIVATE LIMITED";
    cout<<"\n----------------------------------------------------------------------------------------------------------------------------";
    cout<<"\n\n\n\t\t\t             EMPLOYEE DETAILS";
    do{
    cout<<"\n\n Enter the Employee id number to view the details of the Employee and to calculate Gross and Net Pay ";
    cin>>a;
    flag=0;
    for (i=0;i<l;i++)
    {
        if(e[i].emp_id == a)
        {
            flag=1;
            cout<<"\n Employee Name : "<<e[i].name;
            cout<<"\n Employee ID Number : "<<e[i].emp_id;
            cout<<"\n Employee's Basic Pay : "<<e[i].basic_pay;
            cout<<"\n DA : "<<e[i].da;
            cout<<"\n HRA : "<<e[i].hra;
            cout<<"\n PF : "<<e[i].pf;
            cout<<"\n IT : "<<e[i].it;
            cout<<"\n Gross Pay of Employee : "<<e[i].gross_pay;
            cout<<"\n Net Pay of Employee : "<<e[i].net_pay;
            break;
        }
    }
        if(!flag)
        {
           cout<<"\n Invalid Employee ID";
        }
        cout<<"\n Do you want view more Employee Details ? (y/n).. ";
    cin>>ch;
  }while(ch=='y' || ch=='Y');
    return (0);
}

 

Download project

Reviews Report

Submitted by Shivaani Mathan Kandasamy (Shivaani)

Download packets of source code on Coders Packet