码迷,mamicode.com
首页 > 其他好文 > 详细

HW3.13

时间:2016-08-12 11:35:02      阅读:124      评论:0      收藏:0      [点我收藏+]

标签:

技术分享

 

 1 import java.util.Scanner;
 2 
 3 public class Solution
 4 {
 5     public static void main(String[] args)
 6     {
 7         Scanner input = new Scanner(System.in);
 8 
 9         System.out.print("Enter the taxable income: ");
10         double income = input.nextDouble();
11 
12         input.close();
13 
14         double tax = 0;
15 
16         if(income <= 8350)
17             tax = income * 0.10;
18         else if(income <= 33950)
19             tax = 8350 * 0.10 + (income - 8350) * 0.15;
20         else if(income <= 82250)
21             tax = 8350 * 0.10 + (33950 - 8350) * 0.15 + (income - 33950) * 0.25;
22         else if(income <= 171550)
23             tax = 8350 * 0.10 + (33950 - 8350) * 0.15 + (82250 - 33950) * 0.25 + (income - 82250) * 0.28;
24         else if(income <= 372950)
25             tax = 8350 * 0.10 + (33950 - 8350) * 0.15 + (82250 - 33950) * 0.25 + (171550 - 82250) * 0.28 +
26              (income - 171550) * 0.33;
27         else
28             tax = 8350 * 0.10 + (33950 - 8350) * 0.15 + (82250 - 33950) * 0.25 + (171550 - 82250) * 0.28 +
29              (372950 - 171550) * 0.33 + (income - 372950) * 0.35;
30 
31         System.out.println("Tax is " + (int)(tax * 100) / 100.0);
32     }
33 }

 

HW3.13

标签:

原文地址:http://www.cnblogs.com/wood-python/p/5763950.html

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!