exercise 24 from chapter 1