solve exercises 6.15 - 6.18