write exercises 3 - 9