-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathgross salary
32 lines (29 loc) · 1.04 KB
/
gross salary
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
Problem
In a company an emplopyee is paid as under: If his basic salary is less than Rs. 1500, then HRA = 10% of base salary and DA = 90% of basic salary.
If his salary is either equal to or above Rs. 1500, then HRA = Rs. 500 and DA = 98% of basic salary.
If the Employee's salary is input, write a program to find his gross salary.
NOTE: Gross Salary = Basic Salary + HRA + DA
Input
The first line contains an integer T, total number of testcases. Then follow T lines, each line contains an integer salary.
/* package codechef; // don't place package name! */
import java.util.*;
import java.lang.*;
import java.io.*;
/* Name of the class has to be "Main" only if the class is public. */
class Codechef
{
public static void main (String[] args) throws java.lang.Exception
{
Scanner sc=new Scanner(System.in);
int t=sc.nextInt();
for(int i=0;i<t;i++){
int a=sc.nextInt();
if(a<1500){
System.out.println(a+(0.1*a)+(0.9*a));
}
else{
System.out.println(a+(0.98*a)+500);
}
}// your code goes here
}
}