You are on page 1of 1

How to get the gross salary

/import Scanner as we require it.

import java.util.Scanner;

// the name of our class its public

public class GrossSalary {

//void main

public static void main (String[] args)

//declare float

float sal,gsal;

//print message

System.out.println("Enter Basic salary:");

//Take input

Scanner input = new Scanner(System.in);

//calculate

sal = input.nextFloat();

gsal = sal+(sal*0.4f)+(sal*0.2f);

//print the gsal

System.out.println("Gross salary = "+gsal);

You might also like