Completed assignment2 in the rprog course.