complete exercise 3 for chapter 5