initial solution to ProgrammingAssignment2