I am trying to think of an elegant way to solve this problem in Java:
Given an int of 0-100 what is an elegant way to turn it into an enum where each of the enum's possible values correspond to a range of ints.
For example
enum grades{
A -> 90-95%
B -> 85-90%,
C -> 75-85%
...
etc
}
Can anybody think of a concise way to write a method that given an int returns an enum of grades or throws a IllegalArgumentException?