Write a program to find the Gross pay and Net pay of an employee, when the name and basic pay is entered by the user. Calculate the allowances and deductions accordingly. DA = 30% of Basic pay HRA = 15% of Basic Pay PF = 8 % of Basic pay Net pay = basic pay +DA +HRA Gross pay = Net pay - PF
Answers
Answered by
1
Answer:
import java.util.Scanner;
public class Employee
{
public static void main(String args[]) {
Scanner in = new Scanner(System.in);
System.out.print("Enter Basic Pay: ");
double bp = in.nextDouble();
double da = 0.3 * bp;
double hra = 0.15 * bp;
double pf = 0.125 * bp;
double gp = bp + da + hra;
double np = gp - pf;
System.out.println("Gross Pay = " + gp);
System.out.println("Net Pay = " + np);
}
}
Similar questions