18 lines
432 B
Java
18 lines
432 B
Java
|
//: enumerated/menu/Course.java
|
||
|
package enumerated.menu;
|
||
|
import net.mindview.util.*;
|
||
|
|
||
|
public enum Course {
|
||
|
APPETIZER(Food.Appetizer.class),
|
||
|
MAINCOURSE(Food.MainCourse.class),
|
||
|
DESSERT(Food.Dessert.class),
|
||
|
COFFEE(Food.Coffee.class);
|
||
|
private Food[] values;
|
||
|
private Course(Class<? extends Food> kind) {
|
||
|
values = kind.getEnumConstants();
|
||
|
}
|
||
|
public Food randomSelection() {
|
||
|
return Enums.random(values);
|
||
|
}
|
||
|
} ///:~
|