-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathTask7.java
More file actions
51 lines (51 loc) · 1.22 KB
/
Task7.java
File metadata and controls
51 lines (51 loc) · 1.22 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
/*Accept the salary of an employee from the user. Calculate the gross salary on the following basis:
BASIC HRA DA
1 – 4000 10% 50%
4001 – 8000 20% 60%
8001 - 12000 25% 70%
12000 and above 30% 80%
*/
import java.util.*;
class employee
{
public static void main(String... args)
{
Scanner s=new Scanner(System.in);
int basic,salary;
double HRA,DA,Gross;
System.out.print("Enter the salary of an employee=");
salary=s.nextInt();
if(salary==0)
{
System.out.print("Enter the right amount of salary");
}
if(salary>=1 && salary<=4000)
{
HRA=(salary*10)/100;
DA=(salary*50)/100;
Gross=HRA+DA+salary;
System.out.print("Gross Salary="+Gross);
}
else if(salary>=4001 && salary<=8000)
{
HRA=(salary*20)/100;
DA=(salary*60)/100;
Gross=HRA+DA+salary;
System.out.print("Gross Salary="+Gross);
}
else if(salary>8001 && salary<=12000)
{
HRA=(salary*25)/100;
DA=(salary*70)/100;
Gross=HRA+DA+salary;
System.out.print("Gross Salary="+Gross);
}
else //Salary is above the 12000
{
HRA=(salary*30)/100;
DA=(salary*80)/100;
Gross=HRA+DA+salary;
System.out.print("Gross Salary="+Gross);
}
}
}