我正在使用此代码以及一种生成随机数的方法,以用学生 ID 和测验分数填充我的数组。接下来我想找到所有测验分数的平均值/最小值/最大值。我真的被困住了。任何和所有的帮助表示赞赏。
private class FillButtonListener implements ActionListener {
public void actionPerformed(ActionEvent e) {
int quizScore, firstIDin = firstID, row, column;
int[] studentIDsin = new int[numberStudents];
int[][] quizin = new int[numberStudents][numberQuizes];
for(row=0; row<numberStudents; row++) {
studentIDsin[row] = firstIDin;
firstIDin+=1;
}
for(row=0; row<numberStudents; row++) {
studentIDs[row] = studentIDsin[row];
}
for(row=0; row<numberStudents; row++) {
for(column=0; column<numberQuizes;column++) {
quizScore = (int) rand();
quizin[row][column]= quizScore;
}
}
for(row=0; row<numberStudents; row++) {
for(column=0; column<numberQuizes;column++)
quiz[row][column]= quizin[row][column];
}
dispResultsMenuPriv.setEnabled(true);
}
}