chapter 4 code