record Student(String name, int grade, int score) {}

void main() {
    ArrayList<Student> students = new ArrayList<>(List.of(
            new Student("Ada", 9, 88),
            new Student("Grace", 10, 92),
            new Student("Alan", 9, 45),
            new Student("Katherine", 11, 95)));

    ArrayList<Integer> allScores = new ArrayList<>();
    for (Student student : students) {
        allScores.add(student.score());
    }
    IO.println(allScores);

    int total = 0;
    for (int score : allScores) {
        total += score;
    }
    IO.println((double) total / allScores.size());
}

// From Groundwork, chapter 10 (ch10-records), box 9.
// This example is from Groundwork, licensed CC BY-NC-SA 4.0.
// Run with: java ch10_09.java
