Program 15.02 from chapter 15