assignment 2 : r-programming

functions as requested by assignment