Practical Java homework