Added sample code of chapter 4.