Program 15.08 from chapter 15