Programs from chapter 6