通过if分支结构计算个人所得税

package day04;
/*
 * 北京地区的个人所得税的计算公式为:应纳税额=(工资薪金所得-扣除数)×适用税率-速算扣除数。其中,扣除数为3500元
 * 全月应纳税所得额=工资薪金所得-扣除数。
 */
import java.util.Scanner;

/*
 * 通过if分支结构计算个人所得税
 * 1.全月应纳税所得额不超过1500			税率3% 	速算扣除0
 * 2.全月应纳税所得额1500-4500		税率10%	速算扣除105
 * 3.全月应纳税所得额4500-9000		税率20%	速算扣除555
 * 4.全月应纳税所得额9000-35000		税率25%	速算扣除 1005
 * 5.全月应纳税所得额35000-55000		税率30%	速算扣除2755
 * 6.全月应纳税所得额55000-80000		税率35%	速算扣除5505
 * 7.全月应纳税所得额超过80000			税率45%	速算扣除13505
 */

public class 个人所得税计算 {

  public static void main(String[] args) {
      Scanner input=new Scanner(System.in);
      System.out.println("请输入你的 工资:");
      double a = input.nextDouble();
      f(a);
      }
   static void f(double salary) {
    //如果salary没有达到起征点,不交税
    if(salary<=3500) {
    System.out.println("不需要交税!");
    //返回到上面的值
    return;
    }
    //salary减去3500元的起征点
    salary-=3500;
    //定义税率和速算扣除数变量
    double l=0;
    int s=0;
    //根据salary的范围来确定l和s的值
    if(salary<=1500) {
    l=0.03;
    s=0;
    }else if(salary<=4500) {
    l=0.1;
    s=105;
    }else if(salary<=9000) {
    l=0.2;
    s=555;
    }else if(salary<=35000) {
    l=0.25;
    s=1005;
    }else if(salary<=55000) {
    l=0.3;
    s=2755;
    }else if(salary<=80000) {
    l=0.35;
    s=5505;
    }
    else {
    l=0.45;
    s=13505;
    }
    //计算
    salary = salary*l-s;
    System.out.println("个人所得税是:"+salary);
    }
	

}

  • 0
    点赞
  • 1
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值