java的一道题,求个代码,怎么做,求解?
发布网友
发布时间:2023-08-13 03:11
我来回答
共2个回答
热心网友
时间:2024-01-18 23:40
package day04;
import java.util.Scanner;
public class Demo08 {
/**
* 个人所得税计算
*
*/
public static void main(String[] args) {
double salary;// 薪水,税前薪资
double payTax;// 应税薪资
double tax;// 税
double income;// 税后收入
Scanner scanner = new Scanner(System.in);
System.out.print("请输入你的薪资:");
salary = scanner.nextDouble();
payTax = salary - 3500;
if (payTax <= 0)
tax = 0;
else if (payTax <= 1500)
tax = payTax * (3D / 100);
else if (payTax <= 4500)
tax = payTax * (10D / 100) - 105;
else if (payTax <= 9000)
tax = payTax * (20D / 100) - 555;
else if (payTax <= 35000)
tax = payTax * (25D / 100) - 1005;
else if (payTax <= 55000)
tax = payTax * (30D / 100) - 2755;
else if (payTax <= 80000)
tax = payTax * (35D / 100) - 5505;
else
tax = payTax * (45D / 100) - 13505;
income = salary - tax;
System.out.println("你的税后薪资为:"+income);
}
}追问请问大大你能不能写写具体的思路是怎么样的,谢谢啊
追答思路就是 把总钱数减去3500 然后看看 剩余的钱在那个档次中 就进入那个 然后进行计算
热心网友
时间:2024-01-18 23:41
怎么判断含税不含税