Programming Assignment 2 for Progrraming in R class