Java代码计算2019新个税

        不知不觉间帝都已经没有了酷暑的燥热,前几天还下了几场雨,当秋雨冲刷着仲夏的尸体,不得不承认这一伤感的季节又要来了。可谓是一场秋雨一场寒,早晚出行时都能感觉到一丝凉意了。黄昏之时迎着微风走向地铁站(不加班?嗯?),看着摇摇欲坠的树叶以及远处蔚蓝的天空,几朵白云还在互相追赶,闭上眼睛深吸一口气,再缓缓吐出,不得不感叹天凉好个秋,颇为舒适。

        好啦好啦,醒醒吧,2019都过去三分之二了,快看看今年的搬砖的受益如何吧!

        以下是按照新个税政策计算薪资的java代码,FYI (For Your Information)供你们参考!比实际多不要高兴,比实际少可以偷乐!

package com.sinosoft.aikes;

/**
 * 按照2019新个税规则,计算薪资
 * 
 * @author Aikes
 *
 * Created on 2019-08-27
 */
public class TaxCalculate {

	private double mUnitMoney;

	private double mSumMoney;

	private double mSocialFee;

	private int mTimes;

	private int mStartTimes = 1;

	private double mTax;

	/**
	 * 该方法默认一月到当前月薪资相同进行计算,且未考虑附加扣
	 * 除项(继续教育、赡养老人等六项附加扣除条款)
	 * 
	 * @param cMoney  税前月薪
	 * @param cSocialFee  社保+公积金
	 * @param cTimes  薪资计算月(若每6.15发工资,此处填 5 )
	 */
	public void computeSalary(double cMoney, double cSocialFee, int cTimes) {
		
		this.mTimes = cTimes;
		this.mUnitMoney = cMoney;
		this.mSocialFee = cSocialFee;

		computeAllTax();

		// 最后一个月税额需要单独拉出来计算,用于计算当月实际工资
		double tTax = mTimes * (mUnitMoney - 5000 - cSocialFee);
		tTax = computeTax(tTax);

		System.out.println("第" + mStartTimes + "个月税额:" + tTax);

		System.out.println("***********************************");
		System.out.println("* 本年度累计纳税:" + mTax);
		System.out.println("* 本年度累计收入:" + mSumMoney);
		System.out.println("* 本月应缴税额:" + tTax);
		System.out.println("* 本月实收薪资:" + (cMoney - tTax - cSocialFee));
		System.out.println("***********************************");
	}

	/**
	 * 计算年度累计纳税金额
	 * 
	 * @return
	 */
	private double computeAllTax() {
		if (mStartTimes == mTimes)
			return mTax;

		double tTax = mStartTimes * (mUnitMoney - 5000 - mSocialFee);

		tTax = computeTax(tTax);

		System.out.println("第" + mStartTimes + "个月税额:" + tTax);

		mStartTimes++;
		return computeAllTax();
	}

	/**
	 * 计算单次税额
	 * 
	 * @param tTax
	 * @return
	 */
	private double computeTax(double cTax) {
		if (cTax <= 36000) {
			cTax = (cTax * 0.03) - mTax;
		} else if (cTax > 36000 && cTax <= 144000) {
			cTax = (cTax * 0.10 - 2520) - mTax;
		} else if (cTax > 144000 && cTax <= 300000) {
			cTax = (cTax * 0.20 - 16920) - mTax;
		} else if (cTax > 300000 && cTax <= 420000) {
			cTax = (cTax * 0.25 - 31920) - mTax;
		} else if (cTax > 420000 && cTax <= 660000) {
			cTax = (cTax * 0.30 - 52920) - mTax;
		} else if (cTax > 660000 && cTax <= 960000) {
			cTax = (cTax * 0.35 - 85920) - mTax;
		} else {
			cTax = (cTax * 0.45 - 181920) - mTax;
		}
		mTax += cTax;
		mSumMoney += (mUnitMoney - cTax);
		return cTax;
	}

	public static void main(String[] args) {
		new TaxCalculate().computeSalary(35000, 3000, 7);
	}
}

 

  • 0
    点赞
  • 4
    收藏
    觉得还不错? 一键收藏
  • 打赏
    打赏
  • 0
    评论

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

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

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包

打赏作者

Aikes902

你的鼓励将是我创作的最大动力

¥1 ¥2 ¥4 ¥6 ¥10 ¥20
扫码支付:¥1
获取中
扫码支付

您的余额不足,请更换扫码支付或充值

打赏作者

实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

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

余额充值