solve exercise 30.18