exercises 3-6 from chapter 3