Chapter 7 finished code.