Solution for Programming Assigment 2