An exercise from RubyQuiz implemented in Java