a solution for exercise 15.42 (c)