import java.util.ArrayList;
import java.util.Collections;
import java.util.Scanner;
public class GradeStatistic
{
public static void main(String[] args)
{
ArrayList<String> arrayList = new ArrayList<String>();
ArrayList<Integer> arrayList1 = new ArrayList<Integer>();
Scanner input = new Scanner(System.in);
String x = input.next();
int score;
while(x.equals("end"))
{
Scanner in = new Scanner(System.in);
System.out.println("请输入考生姓名 ");
x=in.next();
System.out.println("请输入"+x+"成绩 ");
score=in.nextInt();
arrayList1.add(score);
arrayList.add(x);
}
System.out.println("考生姓名 "+":"+"成绩 ");
int sum=0;
for(int i=0;i<arrayList.size();i++)
{
System.out.println(arrayList.get(i)+":"+arrayList.get(i));
sum+=arrayList1.get(i);
}
Collections.sort(arrayList1);
System.out.println("最低分:"+arrayList1.get(0));
System.out.println("最低分:"+arrayList1.get(arrayList1.size()-1));
double ave=sum/(arrayList1.size()-1);
System.out.println("平均分:"+ave);
}
}
class Mark
{
int score;
String name;
public Mark(String name,int score)
{
this.name=name;
this.score=score;
}
public String toString()
{
return "姓名:"+this.name+" "+this.score;
}
}
这是我写的代码,求帮忙改进,谢谢