Employee Salary

You might also like

Download as docx, pdf, or txt
Download as docx, pdf, or txt
You are on page 1of 2

3.Write a program in JAVA to calculate the Net Pay and the Gross Pay of an Employee.

import java.io.*;

public class employee

public static void main(String args[])throws IOException

int basic;

double DA=0, HRA=0, PF=0, net=0, gross=0;

String name=" ";

InputStreamReader read= new InputStreamReader(System.in);

BufferedReader in=new BufferedReader(read);

System.out.println("A program to calculate the net and gross salary of an employee");

System.out.println("enter the name of an employee");

name=in.readLine();

System.out.println("enter the basic pay of the employee");

basic=Integer.parseInt(in.readLine());

DA=((25*basic)/100);

HRA=((25*basic)/100);

PF=((8.33* basic)/100);

net=basic+DA+HRA;

System.out.println("net salary of an employee is"+net);

gross=net-PF;

System.out.println("gross salary of an employee is"+gross);

}
OUTPUT
A program to calculate the net and gross salary of an employee

enter the name of an employee

poojitha

enter the basic pay of the employee

300000

net salary of an employee is450000.0

gross salary of an employee is425010.0

You might also like