16. JAVA Program to find the Gross Salary of an Employee.
How does this program work?
- In this programme you will learn about how to Calculate the Gross salary of an employee.
- By using the given formula gross_salary = [basic_salary + daily allowance + house_rent] we cand find the answer.
- By using the below code we can easily calculate the gross salary in java programing.
Here is the code
// To Calculate Gross Salary of an employee
import java.util.Scanner;public class salary
{
public static void main(String args[])
{
double basic,da,hra,gross;
System.out.println("Enter Basic salary of the employee\n");
Scanner obj1=new Scanner(System.in);
basic=obj1.nextDouble();
da=40*basic/100;
hra=20*basic/100;
gross= basic+da+hra;
System.out.println("The D.A of the basic salary of the employee is:" +da);
System.out.println("The H.R.A of the basic salary of the employee is:" +hra);
System.out.println("The Gross salary of the employee is:" +gross);
}
}