bluej Programs
5.Write a program to enter the salary of an employee. If his salary is more than equal to 10000, then print bonus amount which is 12% on the salary, otherwise calculate the bonus which is 10% on the salary. Calculate the total salary which is salary + bonus..
import java.util.*;
class bonus
{
void main()
{
Scanner sc=new Scanner(System.in);
double sal,b,gr;
System.out.println("Enter the Salary:");
sal=sc.nextDouble();
if(sal>=10000)
{
b=sal*.12;
}
else
{
b=sal*.10;
}
System.out.println("Bonus Amount:"+b);
gr=sal+b;
System.out.println("Total Salary:"+gr);
}
}
Output:
Enter the Salary: 78000 Bonus Amount:9360.0 Total Salary:87360.0
ADVERTISEMENT
