my complete code for assignment 2 (2)