finished question 3 for assignment 2