solution for chapter 4