solve exercise 4.7 - 4.8