Program 15.19 from chapter 15