programming chapter 2 exercises