solution for assignment 2