In this program, we will read the basic salary of an employee from the user and calculate the employee, employer, and pension contribution of provident fund.
Program/Source Code:
The source code to calculate employee and employer provident fund is given below. the given program is compiled and executed successfully.
// Java program to calculate the Employee
// and Employer Provident Fund
import java.util.Scanner;
public class Main {
public static void main(String[] args) {
Scanner X = new Scanner(System.in);
float basicPay = 0;
float employeeFund = 0;
float employerFund = 0;
float PensionFund = 0;
System.out.printf("Enter basic pay: ");
basicPay = X.nextFloat();
employeeFund = (basicPay / 100) * 12.0F;
employerFund = (basicPay / 100) * 3.67F;
PensionFund = (basicPay / 100) * 8.33F;
System.out.printf("Basic Pay: %f\n", basicPay);
System.out.printf("Employee contribution: %f\n", employeeFund);
System.out.printf("Employer Contribution: %f\n", employerFund);
System.out.printf("Pension Contribution: %f\n", PensionFund);
}
}
In the above program, we imported the "java.util.Scanner" package to read input from the user. Here, we created a public class Main. It contains a static method main().
In this program, we will read the basic salary of an employee from the user and calculate the employee, employer, and pension contribution of provident fund.
Program/Source Code:
The source code to calculate employee and employer provident fund is given below. the given program is compiled and executed successfully.
Output:
Explanation:
In the above program, we imported the "java.util.Scanner" package to read input from the user. Here, we created a public class Main. It contains a static method main().
need an explanation for this answer? contact us directly to get an explanation for this answer