java object oriented homework assignment