进来看看吧~有问题
import java.util.Scanner;
public class ShuZu {
/**
* @param args
*/
public static void main(String[] args) {
// TODO Auto-generated method stub
Scanner scan = new Scanner(System.in);
String[] student = new String[60];
int i=0;
int s = 0;
int k;
for (i = 0; i < 60; i++) {
int w = i + 1;
System.out.println("请输入第" + (i + 1) + "个学生的成绩:");
student[i] = scan.next();
k = Integer.parseInt(student[0]);
s += Integer.parseInt(student[i]);
;// 强行转换。
double avg = s / w;
int max = k;
int min = k;
if (max < Integer.parseInt(student[i])) {
max = Integer.parseInt(student[i]);
}
if (min > Integer.parseInt(student[i])) {
min = Integer.parseInt(student[i]);
}
System.out.println("------------------------------");
System.out.println("是否查看结果?(Y/N)");
String r = scan.next();
if (r.equals("y")) {
System.out.println("你总共输入了" + w + "个同学的成绩。" + " 平均分为:" + avg
+ "\n最高分为:" + max + "最低分为:" + min);
}
}
}
}
//输出的时候~最大值是错误的~就是说不是最大值~而且不固定的错~有时候又是对的。请高手请教
public class ShuZu {
/**
* @param args
*/
public static void main(String[] args) {
// TODO Auto-generated method stub
Scanner scan = new Scanner(System.in);
String[] student = new String[60];
int i=0;
int s = 0;
int k;
for (i = 0; i < 60; i++) {
int w = i + 1;
System.out.println("请输入第" + (i + 1) + "个学生的成绩:");
student[i] = scan.next();
k = Integer.parseInt(student[0]);
s += Integer.parseInt(student[i]);
;// 强行转换。
double avg = s / w;
int max = k;
int min = k;
if (max < Integer.parseInt(student[i])) {
max = Integer.parseInt(student[i]);
}
if (min > Integer.parseInt(student[i])) {
min = Integer.parseInt(student[i]);
}
System.out.println("------------------------------");
System.out.println("是否查看结果?(Y/N)");
String r = scan.next();
if (r.equals("y")) {
System.out.println("你总共输入了" + w + "个同学的成绩。" + " 平均分为:" + avg
+ "\n最高分为:" + max + "最低分为:" + min);
}
}
}
}
//输出的时候~最大值是错误的~就是说不是最大值~而且不固定的错~有时候又是对的。请高手请教
...全文


Java SE
