标签:
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 }
标签:
原文地址:http://www.cnblogs.com/wood-python/p/5763950.html