solve programming assignment 2