Added example code for chapter 6.1

Added example code for chapter 6.1