Third assignment from "Introducing Java"