Java homework assignment nr 2