program from course Java