Programming exercise 2 solutions