finished chapter 8 exercise 1