solve exercises 7.18 - 7.20