Add solution to Programming Question 3