This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
object Payroll { | |
def printSalary(employee: Employee) { | |
val currentYeay = 2001 | |
employee match { | |
case Intern(stay) => | |
println(stay * 300) | |
case Dev(startYear) => | |
println(1000 + (currentYeay - startYear) * 500) | |
case Manager(startYear, direct) => | |
println(1000 + (currentYeay - startYear) * 500 + direct.length * 20) | |
} | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment