final version of Programming Assignment 2