My solution

This is the solution I have programmed for the Programming Assignment 2