hw4 up through problem 3