Created
August 3, 2016 22:51
-
-
Save travisdachi/ba302a8028df85427d90e60a30be3d0e to your computer and use it in GitHub Desktop.
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
class SuGrader(val satisfy: Int = 60) : Grader { | |
init { | |
if (satisfy < 0 || satisfy > 100) | |
throw IllegalArgumentException("A satisfy $satisfy is out of score range of 0-100") | |
} | |
override fun grade(score: Int) = when (score) { | |
in satisfy..100 -> "S" | |
in 0 until satisfy -> "U" | |
else -> "???" | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment