exercise 2.5 in class