Finish chapter 7 exercise