帮我修改一个简单的java程序啊 刚开始学 大家多多指教

2024-11-08 10:57:39
推荐回答(5个)
回答1:

import java.util.Scanner;

public class Test {
public static void main(String[] args){
int a[]={10000,9000,8000,7000,6000,5000,4000,3000,2000};
double b[]={0.45,0.40,0.35,0.30,0.25,0.20,0.15,0.10,0.05};//所得税率
double result=0.0;
while(true){
System.out.println("please input your income");
Scanner in=new Scanner(System.in);
double income=in.nextDouble();
for(int i=0;i {if(income>a[i])
{result=income*b[i];}
break;

}
System.out.println("个人所得税 result="+result);
}
}
}

回答2:

import java.io.*;

有七处错误,完整版如下:
public class CalculateTax{

public static void main(String[] args)
{
System.out.println("please input your income");
Scanner in = new Scanner(System.in);
double income = in.nextDouble();
for(int i=0;iif(income>a[i])
{ result = income*b[i];
break;
}
System.out.println("个人所得税 result="+result);
}
}
}

回答3:

public static void main(String[] args){ }

应该是:static
在你写完代码的时候,myeclipse或eclipse会自动帮你解析是否符合语法规则,在不符合规则的地方会出现红线。。。

回答4:

main方法不是这样重写的吧,。。public static void main(String[] args){ }

回答5:

staic?
应该是
static