← all problems

honorRoll 🌶️🌶️

Write a method that takes an ArrayList<Student> parameter, students, and returns an ArrayList<String> containing the names of every student with BOTH a score of 90 or higher AND an attendance of 90 or higher, in the same order they appear in students.

See the Student: Quick Reference for Student's available methods.

Reference: Student — the methods you can call

class Student

A student record: a name, a score and an attendance percentage. A Student never changes once it is made. You do not write this class; make a record with new Student(name, score, attendance) and call its methods.

Student s = new Student("Ana", 92, 97);
s.getName()                    // "Ana"
s.getLetterGrade()             // "A"
s.isPassing()                  // true
s.toString()                   // "Ana: 92 (A), 97% attendance"
s.equals(new Student("Ana", 92, 97))   // true
MethodWhat it does
Student(String name, int score, int attendance)

Makes a student record.

  • name – the student's name
  • score – the score, as an int
  • attendance – the attendance percentage, as an int
String getName()

The student's name.

Returns the name

int getScore()

The student's score.

Returns the score

int getAttendance()

The attendance percentage.

Returns the attendance percentage

boolean isPassing()

Whether the student is passing.

Returns true if the score is 60 or above

String getLetterGrade()

The letter grade for the score, with the usual 90, 80, 70 and 60 cutoffs.

Returns "A", "B", "C", "D" or "F"

boolean equals(Object o)

Whether another object is a Student with the same name, score AND attendance.

  • o – the object to compare with

Returns true if all three match; false otherwise

String toString()

The student as text, for example "Ana: 92 (A), 97% attendance". It is called for you by System.out.println(s).

Returns the student as text