Program 15.06 from chapter 15