Scala Exercise Code