Homework from Java 2