个税计算器:
(1)通过键盘输入用户的月薪
(2)百度搜索个税计算的方式,计算出应缴纳的税款
(3)直到键盘输入88,则退出程序(使用break退出循环)
import java.util.Scanner;
public class shui {
public static void main(String[] args) {
Scanner s = new Scanner(System.in);
double shui;
while (true) {
System.out.print("请输入你的月薪:>");
int money = s.nextInt();
if (money < 36000)
shui = 0.03f * money;
else {
if (money < 144000)
shui = 0.03 * 36000 + 0.1f * (money - 36000);
else {
if (money < 300000)
shui = 0.03 * 36000 + 0.1 * 108000 + 0.2f * (money - 144000);
else {
if (money < 420000)
shui = 0.03 * 36000 + 0.1 * 108000 + 0.2 * 156000 + 0.25f * (money - 300000);
else {
if (money < 660000)
shui = 0.03 * 36000 + 0.1 * 108000 + 0.2 * 156000 + 0.25 * 120000 + 0.3f * (money - 420000);
else {
if (money < 960000)
shui = 0.03 * 36000 + 0.1 * 108000 + 0.2 * 156000 + 0.25 * 120000 + 0.3 * 140000 + 0.35f * (money - 660000);
else
shui = 0.03 * 36000 + 0.1 * 108000 + 0.2 * 156000 + 0.25 * 120000 + 0.3 * 140000 + 0.35 * 300000 + 0.45f * (money - 960000);
}
}
}
}
}
if (money == 88)
break;
System.out.println("应交税为:>" + shui);
continue;
}
}
}