Part 3 of Programming Assignment 3