code for assignment 5