Part 2 of Programming Assignment 3