Home Show/Hide Menu
Bluej Programs
➜ Test-paper-IT-10
➜ Suggestion Paper, Class-12

bluej Programs

4.Write a program to enter the salary of an employee. Calculate and print the 18% bonus on it. also Print the gross salary which is salary + bonus.

import java.util.*;
class SalaryBonus
{
    void main()
    {
        Scanner sc=new Scanner(System.in);
        int sal;
        double bons,gr;
        System.out.println("Enter the Salary:");
        sal=sc.nextInt();
        bons=sal*18/100.0;
        gr=sal+bons;
        System.out.println("Bonus:"+bons);
        System.out.println("Gross Salary:"+gr);
    }
}


Output:
Enter the Salary:
78956
Bonus:14212.08
Gross Salary:93168.08

 
ADVERTISEMENT