Implementation completed

Code for Assignment of week 2 for the R class on coursera