solution for chapter 5