This is the final version of code of Programming Assignment 2