Finished rprog assignment3