Programming Assignment 1 complete (3 functions)