Program 15.05 from chapter 15