Chapter 3 assignment code