Solve exercise 1.17. Page 31