complete midterm problem 3