public static void main(String[] args) {
Random random = new Random();
//1 创建集合容器对象
ArrayList al = new ArrayList();
//2 创建元素对象,也就是分数
int score;
while(al.size()<70){ //创建70个学生随机的分数
score = random.nextInt(101);
if(!al.contains(score)){
al.add(score);
}
}
int sum = 0;
Iterator it = al.iterator();
while(it.hasNext()){
Integer fenshu = (Integer) it.next();
sum = sum + fenshu;
}
double avg = new Double(sum).doubleValue()/al.size();
System.out.println(al);
System.out.println("总分数是"+sum);
System.out.println("平均分是"+avg);
}