solve exercise 31.02