exercise for scala coding