Skip to content

Instantly share code, notes, and snippets.

@nicgrayson
Created July 9, 2014 16:34
Show Gist options
  • Save nicgrayson/d649ebb6cae064123202 to your computer and use it in GitHub Desktop.
Save nicgrayson/d649ebb6cae064123202 to your computer and use it in GitHub Desktop.
import scala.util.Random
object Module1 {
def add(x: Int, y: Int): Int = x + y
def main {
val employees =
Employee("First", 123) ::
Employee("Second", 234) ::
Employee("Third", 345) ::
Employee("Four", 456) ::
Employee("Five", 567) ::
Nil
employees.foreach(employee => print(employee.name +" "+ employee.time.toString))
}
}
class Employee(name: String, timeEmployed: Int) {
def name(): String = name
def timeEmployed(): Int = timeEmployed
private val age = scala.util.Random.nextInt(100)
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment