Solution for problem 9 and a solution template.