5/11/2017

Java Program for Find The Salary of an Employee With Employee Grade

Problem:- Java Program For Find The Salary Of An Employee With Employee Grade (Performance). or Java Program For Find The Salary Of An Employee With Employee Grade or simple employee program in java or employee details program in java or employee salary calculation program in java or employee details program in java using inheritance or java program for employee details using array or java program for employee payroll or employee salary calculation program in java,

Note:- Please See This is A Requested Problem From Pakistan. See You Can Also Request Any Problem Regarding Programming. So Don't Forgot To Share Thanks, Learning Point (Chowk Azam, Pakistan) Writing For Us.

"write a code in java that input salary and grade of an employee and apply below conditions:

i) in case of grade 15 or above than bonus is 15%
ii) in case of grade 16 or above than bonus is 20%
iii) in case of grade 18 or above than bonus is 25%
iv) after calculating total salary deduct 13% GST in case that salary is 15000 or above. deduct 15% GST and in case that salary is 22000 or above.
v) Add 6% bonus at the end

Calculate net salary according to above condition and display it."




Logic:- So according to first three conditions in the problem I use if-else Statement For a grade of employee see below.

if(grade==15)
{
 bonus=(basic_salary*15)/100;
} 
else if(grade==16 || grade==17 )
{
 bonus=(basic_salary*20)/100;
}
else if(grade>=18)
{
 bonus=(basic_salary*25)/100;
}

After That, We Get a Basic Salary + Bonus. Now According to GST ( Goods and Service Tax ) Conditions Calculate a remaining Salary After All Calculation 6% Bonus.

if(basic_salary>=15000 && basic_salary<22000 basic_salary-="gst;" basic_salary="" bonus1="" else="" gst="(basic_salary*13)/100;" if="">=22000)
{
 gst=(basic_salary*15)/100;
 
 basic_salary-=gst;
 
 bonus1=(basic_salary*6)/100;

 basic_salary+=bonus1;

}
else
{
 bonus1=(basic_salary*6)/100;

 basic_salary+=bonus1;
}
At the end print the Salary.

Example:- Lets Assume Employee Salary is 20,000 And Grade is 15 Then Calculate an Employee Salary.

20,000 Salary and 15 Grade Bonus is 15% then Bonus = 3000.

Now Total Salary is 20,000+3000=23,000

Now Salary is Greater than 22,000 Then 15% GST, So GST = 3450.

Now Total Salary is 23,000 - 3450 = 19550.

At the End 6% Bonus Then Bonus = 1173

So Gross Salary Of Employee is =19500+1173=20723.

Gross Salary = 20723 .

Try This Java Program For Find The Gross Salary Of An Employee


Solution:- Java Program for Find The Salary of an Employee With Employee Grade


import java.util.Scanner;
import java.lang.*;

/* Program By Ghanendra Yadav
   Visit http://www.programmingwithbasics.com
*/

class employeesalary
{
public static void main(String args[]) 
{
 float basic_salary,bonus1=0,bonus=0,gst;
 int grade;
 
 Scanner scan=new Scanner(System.in);

 System.out.println("Enter Basic Salary Of Employee : ");
 basic_salary=scan.nextFloat();

 System.out.println("\nEnter The Grade Of Employee : ");    
 grade=scan.nextInt();
 
if(grade==15)
{
 bonus=(basic_salary*15)/100;
} 
else if(grade==16 || grade==17 )
{
 bonus=(basic_salary*20)/100;
}
else if(grade>=18)
{
 bonus=(basic_salary*25)/100;
}
 
 basic_salary+=bonus;
 
if(basic_salary>=15000 && basic_salary<22000 basic_salary-="gst;" basic_salary="" bonus1="" else="" gst="(basic_salary*13)/100;" if="">=22000)
{
 gst=(basic_salary*15)/100;
 
 basic_salary-=gst;

 bonus1=(basic_salary*6)/100;

 basic_salary+=bonus1;
}
else
{
 bonus1=(basic_salary*6)/100;

 basic_salary+=bonus1;
} 
    System.out.println("\nGross Salary Of Employee : "+basic_salary);
}
} 

Output:-

2 comments: