chapter 9 exercise 9-2: compute grade immediately after read