solution for programming assignment2