add sample code for chapter 8, 9, 10