solve exercises 18.22 - 18.23