Code for Chapter 10