finished rprog assignment 1