scala exercises (P35-P36)