answer to the ProgrammingAssignment2