my code for assignment2