added initial versions of example code for Chapter 2, 3, and 4