hw4 problem 7 finished