栏目分类:
子分类:
返回
名师互学网用户登录
快速导航关闭
当前搜索
当前分类
子分类
实用工具
热门搜索
名师互学网 > IT > 软件开发 > 后端开发 > Java

java:个人所得税计算器

Java 更新时间: 发布时间: IT归档 最新发布 模块sitemap 名妆网 法律咨询 聚返吧 英语巴士网 伯小乐 网商动力

java:个人所得税计算器

计算个人所得税的缴纳情况。用户从控制台输入税前工资额金额,系统根据用户输入的工作金额计算应缴纳的税额

工资个税的计算公式为:
应纳税额 = (工资薪资所得 - 扣除数)* 适用税率 - 速算扣除数
全月应纳税所得额 = 月工资薪资所得 - 扣除数
2011年9月1日起执行7级超额累进税率:扣除数为3500元

具体代码如下:

package day03;
import java.util.Scanner;

public class Incometax {

	public static void main(String[] args) {
		Scanner scan = new Scanner(System.in);
		System.out.println("请输入税前工资金额(¥):");
		double total = scan.nextDouble();
		if(total < 3500) {
			System.out.println("您不需要缴纳个人所得税!");
		}else if((total - 3500) <= 4500) {
			double tax = (total - 3500) * 3/100;
			System.out.println("您应缴纳:"+tax+"元个人所得税");
		}else if((total - 3500) <= 4500) {
			double tax = (total - 3500) * 10/100 - 105;
			System.out.println("您应缴纳:"+tax+"元个人所得税");
		}else if((total - 3500) <= 9000) {
			double tax = (total - 3500) * 20/100 - 555;
			System.out.println("您应缴纳:"+tax+"元个人所得税");
		}else if((total - 3500) <= 35000) {
			double tax = (total - 3500) * 25/100 - 1005;
			System.out.println("您应缴纳:"+tax+"元个人所得税");
		}else if((total - 3500) <= 55000) {
			double tax = (total - 3500) * 30/100 - 2755;
			System.out.println("您应缴纳:"+tax+"元个人所得税");
		}else if((total - 3500) <= 80000) {
			double tax = (total - 3500) * 35/100 - 5505;
			System.out.println("您应缴纳:"+tax+"元个人所得税");
		}else {
			double tax = (total - 3500) * 45/100 - 13505;
			System.out.println("您应缴纳:"+tax+"元个人所得税");
		}
		

	}

}

代码优化:

package day03;
import java.util.Scanner;

public class Incometax {

	public static void main(String[] args) {
		Scanner scan = new Scanner(System.in);
		System.out.println("请输入税前工资金额(¥):");
		double total = scan.nextDouble();
		double taxIncome = total - 3500;
		double tax = 0.0;
		if(total < 3500) {
			tax = 0.0;
		}else if(taxIncome <= 4500) {
			tax = taxIncome * 3/100;
		}else if(taxIncome <= 4500) {
			tax = taxIncome * 10/100 - 105;
		}else if(taxIncome <= 9000) {
			tax = taxIncome * 20/100 - 555;
		}else if(taxIncome <= 35000) {
			tax = taxIncome * 25/100 - 1005;
		}else if(taxIncome <= 55000) {
			tax = taxIncome * 30/100 - 2755;
		}else if(taxIncome <= 80000) {
			tax = taxIncome * 35/100 - 5505;
		}else {
			tax = taxIncome * 45/100 - 13505;
		}
		System.out.println("您应缴纳:"+tax+"元个人所得税");
		

	}

}

转载请注明:文章转载自 www.mshxw.com
本文地址:https://www.mshxw.com/it/782273.html
我们一直用心在做
关于我们 文章归档 网站地图 联系我们

版权所有 (c)2021-2022 MSHXW.COM

ICP备案号:晋ICP备2021003244-6号