Joe prob2 solution