public class Exam implements Measureable { private String name; private int score; public Exam(String n, int s) { name = n; score = s; } // Ordinarily an exam score is an integer, but the // Measureable interface requires all measurements to // be double (for greater flexibility). So we cast to double. public double getValue() { return (double) score; } // Give both the name and the score for this exam. public String toString() { return name + " " + score + "%"; } }