The code for assigment2