homework 8 - add solution to problem 2