Employee Salary Based Program in Java

Employee Salary Based Program in Java
Employee Salary Based Program in Java

import java.util.*;
/**
 * Define a class employee with the following members to compute the salary slip of an employee.
 * @author (Afaq)
 */
public class Employee
{
    int empno;
    String name;
    float salary, hra, da, it, gp;
    Employee()
    {
        empno=0;
        name = "";
        salary = 0.0f;
        hra = 0.0f;
        da = 0.0f;
        it = 0.0f;
        gp = 0.0f;
    }
    void unit()
    {
        Scanner sc=new Scanner(System.in);
        System.out.print("Enter Employee number=");
        empno = sc.nextInt();
        System.out.print("Enter name=");
        name = sc.next();
        System.out.print("Enter salary=");
        salary = sc.nextFloat();
    }
    void calc()
    {
        hra = salary * 0.1f;
        da = salary * 0.555f;
        it = salary * 0.06f;
        gp = salary + hra + da - it ;
        
    }
    void display()
    {
        System.out.println("             Salary Slip\n");
        System.out.println("Employee number="+empno);
        System.out.println("Name="+name);
        System.out.println("Basic pay="+salary);        
        System.out.println("Housing Rent Allowance="+hra);    
        System.out.println("Dearness Allowance="+da);
        System.out.println("Income Tax="+it);
        System.out.println("Grass pay="+gp);
    }
    public static void main(String args[])
    {
        Employee e = new Employee();
        e.unit();
        e.calc();
        e.display();
    }
}

Output:

             Salary Slip

Employee number=123
Name=asdsad
Basic pay=5000.0
Housing Rent Allowance=500.0
Dearness Allowance=2775.0
Income Tax=300.0
Grass pay=7975.0
calculate employee salary in java creating employee payroll program in java employee class employee payroll program in java employee payroll program in java in hindi employee payroll program in java in urdu employee payroll system employee salary employee salary program how to create employee payroll program in java java employee salary program java employee salary program filipino java program to calculate salary of employees salary in java
Recent Posts