Completed code forproblem 5.