ADVERTISEMENT
ADVERTISEMENT

# Java program to calculate the employee and employer provident fund

Input the basic salary of an employee, write a Java program to calculate the employee and employer provident fund.
Submitted by Nidhi, on February 23, 2022

Problem Solution:

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().

The main() method is an entry point for the program. And, we read the basic salary of an employee from the user using the nextFloat() method and calculated employee, employer, and pension contribution of Provident Fund. After that, we printed the result.

ADVERTISEMENT
ADVERTISEMENT

Preparation

What's New

ADVERTISEMENT

Top Interview Coding Problems/Challenges!

ADVERTISEMENT

ADVERTISEMENT

Comments and Discussions!

ADVERTISEMENT
ADVERTISEMENT
ADVERTISEMENT
ADVERTISEMENT
ADVERTISEMENT

Languages: » C » C++ » C++ STL » Java » Data Structure » C#.Net » Android » Kotlin » SQL
Web Technologies: » PHP » Python » JavaScript » CSS » Ajax » Node.js » Web programming/HTML
Solved programs: » C » C++ » DS » Java » C#
Aptitude que. & ans.: » C » C++ » Java » DBMS
Interview que. & ans.: » C » Embedded C » Java » SEO » HR
CS Subjects: » CS Basics » O.S. » Networks » DBMS » Embedded Systems » Cloud Computing
» Machine learning » CS Organizations » Linux » DOS
More: » Articles » Puzzles » News/Updates

© https://www.includehelp.com some rights reserved.