chapters 3 to 9 code