submission of program 2 for R programming class