chapter 6 code