Filling the bodies of the functions

Solution to the Programming Assigment 2 of the course rprog-004