This is the code for Programming Assignment 2