18 lines
404 B
Java
Raw Normal View History

2015-09-07 11:44:36 -06:00
// enums/menu/Course.java
2015-06-15 17:47:35 -07:00
package enums.menu;
import onjava.*;
2015-06-15 17:47:35 -07:00
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);
}
2015-09-07 11:44:36 -06:00
}