Java程序编写----个人所得税计算器编写

 1 package com.lovo;
 2 
 3 import java.util.Scanner;
 4 
 5 public class TaxCalculator {
 6     private static final int B = 3500;
 7 
 8     public static void main(String[] args) {
 9         Scanner sc = new Scanner(System.in);
10         System.out.println("请输入工资:");
11         double salary = sc.nextDouble();
12         System.out.println("请输入五险一金");
13         double ins = sc.nextDouble();
14         double beyond = salary - ins - B;
15         double tax = 0;
16         if (beyond <= 0) {
17             tax = 0;
18         } else if (beyond <= 1500) {
19             tax = beyond * 0.03;
20         } else if (beyond <= 4500) {
21             tax = beyond * 0.1 - 105;
22         } else if (beyond <= 9000) {
23             tax = beyond * 0.2 - 555;
24         } else if (beyond <= 35000) {
25             tax = beyond * 0.25 - 1005;
26         } else if (beyond <= 55000) {
27             tax = beyond * 0.3 - 2755;
28         } else if (beyond <= 80000) {
29             tax = beyond * 0.35 - 5505;
30         } else {
31             tax = beyond * 0.45 - 13505;
32         }
33         System.out.println("应缴纳个人所得税:" + tax);
34         sc.close();
35     }
36 
37 }

 

posted @ 2014-10-15 20:15  无痕DX  阅读(2550)  评论(0)    收藏  举报