Program 11.1 from chapter 11