chapter5 code (no exercises)