package 控制流程;
import java.util.Scanner;
//已知:
//工资个税的计算公式为:应纳税额 = (工资薪金所得 - 五险一金个人负担部分 - 扣除税)* 适用税率 - 速算扣除数)
//2011年 9月1日起调整后的7级超额累进税率:扣除数为:3500元
// 全月应纳税所得额 税率 速算扣除数(元)
// 小于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
public class Case12_个税计算器 {
public static void main(String[] args) {
Scanner in = new Scanner(System.in);
System.out.println("请输入您的税前工资:");
double salary = in.nextDouble();
if(salary<0) {
System.out.println("您是在开玩笑吗?");
System.exit(0); //退出当前程序
}
//应纳所得税
double taxableIncome = salary - salary * 0.1 -3500;
if(taxableIncome <= 0) {
System.out.println("您的工资太低了,不用缴税!");
System.exit(0); //退出当前程序
}
if(taxableIncome <= 1500) {
System.out.println("应纳税所得额:"+ taxableIncome + "税率:3%" + " 速算扣除数:0");
System.out.println("应纳税款:"+ (taxableIncome * 0.03 - 0 ));
}else if(taxableIncome <= 4500) {
System.out.println("应纳税所得额:"+ taxableIncome + "税率:10%" + " 速算扣除数:105");
System.out.println("应纳税款:"+ (taxableIncome * 0.1 - 105 ));
}else if(taxableIncome <= 9000) {
System.out.println("应纳税所得额:"+ taxableIncome + "税率:20%" + " 速算扣除数:555");
System.out.println("应纳税款:"+ (taxableIncome * 0.2 - 555 ));
}else if(taxableIncome <= 35000) {
System.out.println("应纳税所得额:"+ taxableIncome + "税率:25%" + " 速算扣除数:1005");
System.out.println("应纳税款:"+ (taxableIncome * 0.25 - 1005 ));
}else if(taxableIncome <= 55000) {
System.out.println("应纳税所得额:"+ taxableIncome + "税率:30%" + " 速算扣除数:2755");
System.out.println("应纳税款:"+ (taxableIncome * 0.3 - 2755 ));
}else if(taxableIncome <= 80000) {
System.out.println("应纳税所得额:"+ taxableIncome + "税率:35%" + " 速算扣除数:5505");
System.out.println("应纳税款:"+ (taxableIncome * 0.35 - 5505 ));
}else {
System.out.println("应纳税所得额:"+ taxableIncome + "税率:45%" + " 速算扣除数:13505");
System.out.println("应纳税款:"+ (taxableIncome * 0.1 - 13505 ));
}
}
}