solve exercises 6.28 - 6.31