Finish chapter5 exercise