implements and satisfies test for exercise 9