-
Notifications
You must be signed in to change notification settings - Fork 2
Expand file tree
/
Copy pathIncomeTaxCalculator.java
More file actions
52 lines (47 loc) · 1.83 KB
/
IncomeTaxCalculator.java
File metadata and controls
52 lines (47 loc) · 1.83 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
52
import java.util.Scanner;
public class IncomeTaxCalculator {
public static void main(String[] arguments) {
Scanner sc = new Scanner(System.in);
System.out.print("Please enter your income in Lakhs Per Annum : ");
float tax = 0;
float income = sc.nextFloat();
if (income <= 4.0) {
tax = tax + 0;
}
else if (income > 4.0 && income <= 8.0) {
tax = tax + 0.05f * (income - 4.0f);
}
else if (income > 8.0f && income <= 12.0f) {
tax = tax + 0.05f * (8.0f - 4.0f);
tax = tax + 0.1f * (income - 8.0f);
}
else if (income > 12.0f && income <= 16.0f) {
tax = tax + 0.05f * (8.0f - 4.0f);
tax = tax + 0.1f * (12.0f - 8.0f);
tax = tax + 0.15f * (income - 12.0f);
}
else if (income > 16.0f && income <= 20.0f) {
tax = tax + 0.05f * (8.0f - 4.0f);
tax = tax + 0.1f * (12.0f - 8.0f);
tax = tax + 0.15f * (16.0f - 12.0f);
tax = tax + 0.2f * (income - 16.0f);
}
else if (income > 20.0f && income <= 24.0f) {
tax = tax + 0.05f * (8.0f - 4.0f);
tax = tax + 0.1f * (12.0f - 8.0f);
tax = tax + 0.15f * (16.0f - 12.0f);
tax = tax + 0.2f * (16.0f - 20.0f);
tax = tax + 0.25f * (income - 20.0f);
}
else if (income > 24.0f) {
tax = tax + 0.05f * (8.0f - 4.0f);
tax = tax + 0.1f * (12.0f - 8.0f);
tax = tax + 0.15f * (16.0f - 12.0f);
tax = tax + 0.2f * (16.0f - 20.0f);
tax = tax + 0.25f * (24.0f - 20.0f);
tax = tax + 0.3f * (income - 24.0f);
}
System.out.println("The total payable tax is : " + tax);
sc.close();
}
}