21 lines
566 B
Java
21 lines
566 B
Java
// enums/menu/Course.java
|
|
// (c)2020 MindView LLC: see Copyright.txt
|
|
// We make no guarantees that this code is fit for any purpose.
|
|
// Visit http://OnJava8.com for more book information.
|
|
package enums.menu;
|
|
import onjava.*;
|
|
|
|
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);
|
|
}
|
|
}
|