← Unit 3 · all exercises
Saved in this browser only

A student record

Write a Student class storing a name and a score. The constructor takes both. getName returns the name, and passed returns true when the score is 60 or more.

class Student { Student(String name, int score); String getName(); boolean passed(); }

Student.java
Loading editor…
Results

Examples

  • new Student("Ada", 75).getName() → Ada
  • new Student("Ada", 75).passed() → true

There are also 3 hidden tests you can't see. Solve the problem, not the examples.