Write a program in JAVA to input name and basic salary of an employee. Calculate and display the gross salary and net salary when:
da=30% of basic
hra=12.5% of basic
pf=10% of basic
gross=basic+da+hra
net pay=gross-pf
Answers
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);
}}
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);
}}