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<Student> ninthGraders = new ArrayList<>();
    for (Student student : students) {
        if (student.grade() == 9) {
            ninthGraders.add(student);
        }
    }

    for (Student student : ninthGraders) {
        IO.println(student.name());
    }
}

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