working on the eamples in the book chapter 7,8,9.