Part 3 of Programming Assignment 1