scala exercises (P25-P26)