Assignment 3: finished problem 2