solutions to exercises of chapter methods