scala exercises (P10)