solve exercises 18..29 - 18.30