solve exercise 31.16