Q:

Java program to calculate the employee and employer provident fund

belongs to collection: Java Basic Programs

0

Java program to calculate the employee and employer provident fund

All Answers

need an explanation for this answer? contact us directly to get an explanation for this answer

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);
  }
}

Output:

Enter basic pay: 15430
Basic Pay: 15430.000000
Employee contribution: 1851.600098
Employer Contribution: 566.281006
Pension Contribution: 1285.318970

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

total answers (1)

Java Basic Programs

This question belongs to these collections

Similar questions


need a help?


find thousands of online teachers now
Java program to calculate the gratuity of an emplo... >>
<< Java program to print the value in decimal, octal,...