Finish ch5 exercise