R Programming Assignment 2

Updated the R code for the assignment, uploaded a test code for testing
the functions