complete code for assigment 2