Scala: First programming assignment