展开全部
处于严禁和各种32313133353236313431303231363533e58685e5aeb931333363383461考虑(习惯了),代码比较严谨,你那去交作业不会被骂的,就是内容多点;public static void main(String[] args) {
try {
boolean type = true;
Scanner scanner = null;
int num = 0;
double sum = 0;
while(type){
System.out.println("请输入你要计算的科目数:");
scanner = new Scanner(System.in);
try {
num = scanner.nextInt();
break;
} catch (InputMismatchException e) {
System.err.println("输入数据有误,请输入数字!!");
}
}
double[] results = new double[num];
type = true;
for (int i = 0; i
while(type){
System.out.println("请输入第" + (i+1) + "门成绩:");
scanner = new Scanner(System.in);</