WAP to input basic salary of an employee to calculate and print the net pay using the given formula:
Net pay=basic salary +DA+TA+HRA-IT. Where
DA = 30% of basic salary
TA = 25% of basic salary HRA=15% of basicsalary IT = 12% of basic salary
WRITE THE PROGRAM IN JAVA
Answers
Answered by
3
import java.util.*;
Class employee
{
public static void main (string args[])
{
Scanner sc = new Scanner ( System.in);
System.out.println("Enter the name of the employee");
string nm = in.next();
System.out.println ("Enter the basic salary")
int sal = in.nextInt();
{
double da , hra ,pf, gp =0.00, np=0.00;
da = 0.30*sal;
hra=12.5*sal;
pf=0.10*sal;
gp = sal+ da+hra;
np = gp - pf;
}
System.out.println(" Name of the employee :"+nm);
System.out.println("Basic salary : "+sal);
System.out.println("Gross salary :"+ gp);
System.out.println(" Net salary "+np);
}}
Similar questions