Programming Exercise 2 Solution