solution code to assignment 5