import java.util.Scanner;
public class GrossSalaryCalculator {
public static void main(String[] args) {
Scanner scanner = new Scanner(System.in);
System.out.print("Enter the basic salary of the employee: ");
double basicSalary = scanner.nextDouble();
System.out.print("Enter the years of service of the employee: ");
int yearsOfService = scanner.nextInt();
double bonus = (basicSalary >= 20000 && yearsOfService >= 5) ? 2000 : 1000;
double ta = 0.10 * basicSalary;
double da = 0.20 * basicSalary;
double hra = 0.05 * basicSalary;
double grossSalary = basicSalary + ta + da + hra + bonus;
System.out.println("Gross Salary of the employee: " + grossSalary);
}
}
No comments:
Post a Comment