completing Programming Assignment 2