added assignment 3 question 4, 5 code