code for assignment1