Solution to Programming Assignment 2 with Comments

The comments explain the function that are defined as mentioned.
The functions are properly formated.