java Scanner
public static void main(String[] args) throws IOException {
System.out.print("Enter a number:");
Scanner in = new Scanner(System.in);
boolean available = in.hasNextInt();
if(!available){
System.out.println("......请输入一个数字......");
}else{
int x = in.nextInt();
System.out.println("输入金额:"+x);
String y = "";
if(x<=3500){
y="不需要交税";
}else if(x > 3500 && x <=5000 ){
y = "应征税:"+((x-3500)*0.03);
}else if(x > 5000 && x <= 8000 ){
y = "应征税:"+((x-5000)*0.1 + 1500*0.03);
}else if(x > 8000 && x <= 12500 ){
y = "应征税:"+((x-8000)*0.2 + 3000*0.1 + 1500*0.03);
}else if(x > 12500 && x <= 15000 ){
y = "应征税:"+((x-12500)*0.25 + 4500*0.2 + 3000*0.1 + 1500*0.03);
}else if(x > 15000 ){
y = "应征税:"+((x-15000)*0.3 + 2500*0.25 + 4500*0.2 + 3000*0.1 + 1500*0.03);
}
System.out.println(y);
}
}
感谢您的阅读,您的支持是我写博客动力。