JAVA作业——工资个税计算器

*  工资个税的计算公式为:
*  应纳税额=(工资薪金所得 -“五险一金”-扣除数)×适用税率-速算扣除数
*  起征点(5000元)
*  全月应纳税所得额                        税率                 速算扣除数(元)
*  全月应纳税额不超过1500元                 3%                   0
*  全月应纳税额超过1500元至4500元           10%                  105
*  全月应纳税额超过4500元至9000元           20%                  555
*  全月应纳税额超过9000元至35000元          25%                  1005
*  全月应纳税额超过35000元至55000元         30%                  2755
*  全月应纳税额超过55000元至80000元         35%                  5505
*  全月应纳税额超过80000元                  45%                  13505
*
*  1、通过键盘输入用户的月薪。
*  2、键盘输入88,则退出程序(使用break退出循环),输入66继续。

运行结果图:

代码如下:

import java.util.Scanner;
public class IncomeTaxCalculator {
    public static void main(String[] args) {
        Scanner s=new Scanner(System.in);
        System.out.println("*****工资个税计算器*****");
        while (true) {
            System.out.println("请输入月薪:");
            double Salary = s.nextDouble();//月薪
            double mSalary= Salary-5000;//应纳税所得额 (各项社保=0)
            double shui=0;//应纳税额
            if (mSalary<=0){
                System.out.println("不需要交税");
            } else if (mSalary<=1500) {
                shui=mSalary*0.03;
            }else if (mSalary<=4500){
                shui=mSalary*0.1-105;
            }else if (mSalary<=9000){
                shui=mSalary*0.2-555;
            }else if (mSalary<=35000){
                shui=mSalary*0.25-1005;
            }else if (mSalary<=55000){
                shui=mSalary*0.3-2755;
            }else if (mSalary<=80000){
                shui=mSalary*0.35-5505;
            }else {
                shui=mSalary*0.45-13505;
            }
            System.out.println("个税="+shui);
            double Income=Salary-shui;
            System.out.println("薪资="+Income);

            System.out.println("输入88,退出程序!输入66继续!");
            int comm= s.nextInt();
            if (comm==88){
                System.out.println("程序结束!");
                break;
            }else if (comm==66){
                System.out.println("计算下一个!");
                continue;
            }
        }
    }
}

 

 

  • 3
    点赞
  • 17
    收藏
    觉得还不错? 一键收藏
  • 3
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论 3
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值