solve exercise 31.10