code for the assignment