Programming Examples

Java program to input the Basic Pay of an employee and find the gross pay of the employee for the following allowances and deductions


Write a program to input the Basic Pay of an employee and find the gross pay of the employee for the following allowances and deductions.

Dearness Allowance = 25% of Basic Pay

House Rent Allowance=15% of Basic Pay

Provident Fund=8.33% of Basic Pay

Net Pay=Basic Pay + Dearness Allowance + House Rent Allowance

Gross Pay= Net Pay – Provident Fund

Solution

import java.util.*;
class Salary
{
	public static void main(String arr[])
	{
		Scanner sc=new Scanner(System.in);
		float bp,da,hra,pf,np,gp;
		System.out.println(“Enter the basic pay:”);
		bp=sc.nextFloat();
		da=25/100f*bp;
		hra=15/100f*bp;
		pf=8.33f/100*bp;
		np=bp+da+hra;
		gp=np-pf;
		System.out.println(“Gross Pay:”+gp);
	}
}
Output

Latest Current Affairs 2025 Online Exam Quiz for One day Exam Online Typing Test CCC Online Test 2025 Python Programming Tutorials Best Computer Training Institute in Prayagraj (Allahabad) Best Java Training Institute in Prayagraj (Allahabad) Best Python Training Institute in Prayagraj (Allahabad) O Level Online Test in Hindi Bank SSC Railway TET UPTET Question Bank career counselling in allahabad Sarkari Naukari Notification Best Website and Software Company in Allahabad Sarkari Exam Quiz