Java Program to Calculate Salary for Employees

Get employee wages and number of days worked from user and find Basic Pay, DA, HRA, PF and Net Pay. (Note HRA, DA and PF are 10%,5%and 12% of basicpay respectively.)

Sample Input 1: 300 30

Sample Output 1:

Basic Pay:3000

DA: 150 HRA:300

PF:360

Net Pay: 3090

Flow Chart Design

Java Program to Calculate Salary for Employees Flow Chart

Try your Solution

Strongly recommended to Solve it on your own, Don't directly go to the solution given below.

public class Hello { public static void main(String args[]) { //Write your code here } }

Program or Solution

				
			
					
//To Calculate The Salary Of Employess...

import java.util.*;

class Program
{
  public static void main(String args[])
   {
       int wages,days;
       double basic,HRA,DA,PF,netsalary;

       Scanner sc=new Scanner(System.in);
	
       System.out.println("Enter The No.Of Days:");
       days=sc.nextInt();

      System.out.println("Enter The Wages:");
      wages=sc.nextInt();

      basic=wages*days;
      HRA=basic*0.1;
      DA=basic*0.05;
      PF=basic*0.12;  
      netsalary=basic+HRA+DA-PF;
	
      System.out.println("The Basic Pay Is:"+basic);
      System.out.println("The HRA Is:"+HRA);
      System.out.println("The DA Is:"+DA);
      System.out.println("The PF Is:"+PF);
      System.out.println("The NETSALARY Is:"+netsalary);

   }
} 
			
				
			

Program Explanation

Comments