scala exercises (P62B)