Program 15.09 from chapter 15