added Exercise 4 and the chapter example code it depends upon (needs more testing code);