Add solution to Programming Question 2