I have inserted my code for Programming Assignment 2