R Programming - assignment 2

My attempt at coding the 2 functions needed to implement the solution to
RPROG-016 assignment 2