Programming exercise 2.