This is the updated code for Programming Assignment 2