Thursday, 11 May 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).

Note :- Please See This is A Requested Problem From Pakistan .See You Can Also Requested 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.
"


Java Program For Find The Salary Of An Employee With Employee Grade


Logic :- So according to first three condition in problem i use if else Statement For 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)
{
gst=(basic_salary*13)/100;

basic_salary-=gst;

bonus1=(basic_salary*6)/100;

basic_salary+=bonus1;

}
else if(basic_salary>=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 a 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 :-

import java.util.Scanner;
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)
{
gst=(basic_salary*13)/100;

basic_salary-=gst;

bonus1=(basic_salary*6)/100;

basic_salary+=bonus1;

}
else if(basic_salary>=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 :-


Java Program For Find The Salary Of An Employee With Employee Grade

2 comments:
Write comments

Recommended Posts × +