hw4 through problem 6