completed Homework3 Problem 2