-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathtxM.java
More file actions
50 lines (31 loc) · 1.05 KB
/
Copy pathtxM.java
File metadata and controls
50 lines (31 loc) · 1.05 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
package E3;
import java.util.Scanner;
public class txM {
public static void main(String[] args) {
final double rate1 = 0.10;
final double rate2 = 0.25;
final double rate1_singlelimit = 32000;
final double rate1_marriedlimit = 64000;
final double Additionaltax_single = 4400;
final double Additionaltax_married = 8800;
double income;
String status;
double tax;
Scanner in = new Scanner(System.in);
System.out.println("Please enter your marital status ('S' or 'M'): ");
status = in.next();
System.out.println("Please enter your income ($): ");
income = in.nextDouble();
if (status.equals("S"))
if (income <= rate1_singlelimit)
tax = rate1 * income;
else
tax = Additionaltax_single + rate2 * (income - rate1_singlelimit);
else
if (income <= rate1_marriedlimit)
tax = rate1 * income;
else
tax = Additionaltax_married + rate2 * (income - rate1_marriedlimit);
System.out.println("Tax to be paid: $" + tax);
}
}