scala exercises (P28)