Homework for java object-orriented programming class