solve exercises 16.38 - 16.40