Solution to Programming Question 1