Solution to Programming Assignment 1