个人所得税计算(java)

时间:2024-02-17 20:32:19
 1 package com.fj;
 2 
 3 import java.util.Scanner;
 4 
 5 public class TaxCalculator {
 6     //五险一金的假定金额
 7     private static int INSURANCE=1000;
 8     //国家规定交税额
 9     private static int STATUORY_WAGE=3500;
10     public static void main(String[] args) {
11         Scanner scanner=new Scanner(System.in);
12         System.out.print("请输入税前工资:");
13         if (scanner.hasNextDouble()) {
14             double wage=scanner.nextDouble();
15             double overStepWage=wage-INSURANCE-STATUORY_WAGE;
16             double tax=0;
17             if (overStepWage<=0) {
18             }
19             else if (overStepWage<=1500) {
20                 tax=overStepWage*0.03;
21             }
22             else if (overStepWage<=4500) {
23                 tax=overStepWage*0.1-105;
24             }
25             else if (overStepWage<=9000) {
26                 tax=overStepWage*0.2-555;
27             }
28             else if (overStepWage<=35000) {
29                 tax=overStepWage*0.25-1005;
30             }
31             else if (overStepWage<=55000) {
32                 tax=overStepWage*0.3-2755;
33             }
34             else if (overStepWage<=80000) {
35                 tax=overStepWage*0.35-5505;
36             }else {
37                 tax=overStepWage*0.45-13505;
38             }
39             System.out.println("您所应该缴纳的个人所得税为:"+tax+"元。");
40         }else {
41             System.out.print("请输入正确的工资数目!");
42         }
43         scanner.close();
44 
45     }
46 
47 }

以上就是自己用java写的简单的个人所得税计算器。