final version of Programming Assigment 2