Added code for question 2

Time used for question 2: 51 minutes