Programming exercises 7 and 8