Advanced java assignment 6