solve exercises 7.27 - 7.30