个税计算器

import java.text.NumberFormat;
import java.util.Scanner;

/**
*

  • 工资个税的计算公式:应纳税额=(工资薪资所得-"五险一金"个人负担部分-扣除数)*适用税率-速算扣除数
  • 2011年9月1日起调整后的7级超额累进税率:扣除数为3500元
  • 全月应纳税所得额 税率 速算扣除数(元)
  • <=1500                 3%             0
    
  • <=4500                 10%            105
    
  • <=9000                 20%            555
    
  • <=35000                25%            1005
    
  • <=55000                30%            2755
    
  • <=80000                35%            5505
    
  • >80000                 45%            13505
    
  • @author 13065

*/
public class geshujishuqi {

public static void main(String[] args) {
	// TODO Auto-generated method stub
       Scanner sc = new Scanner(System.in);
       System.out.println("请用户输入税前工资:");
       double salary = sc.nextDouble();
      
       if(salary<0)
       {
    	   System.out.println("用户输入错误!!1");
           System.exit(0);//当前程序退出
           
       }
       //应纳税所得额
       double taxableIncome = salary-salary*0.1-3500;
       double taxRate = 0;//税率
       double deduct = 0;//速算扣除数
       double tax = 0;
       NumberFormat nFormat = NumberFormat.getNumberInstance();
       nFormat.setMaximumFractionDigits(2);//设置小数点后面为2位
       if(taxableIncome <= 0)
       {
    	   System.out.println("工资太少,不用交税!");
    	   System.exit(0);//当前程序退出
       }
       else if(taxableIncome <=1500)
       {
    	   taxRate = 0.03;
    	   deduct = 0;
       }
       else if(taxableIncome <=4500)
       {
    	   taxRate = 0.1;
    	   deduct = 105;
       }   
       
       else if(taxableIncome <=9000)
       {
    	   taxRate = 0.2;
    	   deduct = 555;
       }
       
       else if(taxableIncome <=35000)
       {
    	   taxRate = 0.25;
    	   deduct = 1005;
       }   
       
       else if(taxableIncome <=55000)
       {
    	   taxRate = 0.3;
    	   deduct = 2755;
    	  
       }
       
       else if(taxableIncome <=80000)
       {
    	   taxRate = 0.35;
    	   deduct = 5505;
    	   
       }
       
       else if(taxableIncome > 80000)
       {
    	   taxRate = 0.45;
    	   deduct = 13505;
    	   
       }
       System.out.println("应纳税所得额  " + nFormat.format(taxableIncome) + " 税率  "+taxRate +"速算扣除数" + deduct);
	   tax = taxableIncome*taxRate - deduct;
       System.out.println("应缴税款: " + nFormat.format(tax));
	   System.out.println("实发工资" + nFormat.format(salary*0.9-tax));

你可能感兴趣的:(练习)