balance of chapter 5 code