-
Notifications
You must be signed in to change notification settings - Fork 4
Expand file tree
/
Copy pathBurrito.java
More file actions
34 lines (30 loc) · 749 Bytes
/
Burrito.java
File metadata and controls
34 lines (30 loc) · 749 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
package thinkinginjava.initialization;
public class Burrito {
Spiciness degree;
public Burrito(Spiciness degree) {
this.degree = degree;
}
public void describe() {
System.out.print("This burrito is ");
switch (degree) {
case NOT:
System.out.println("not spicy at all.");
break;
case MILD:
case MEDIUM:
System.out.println("a little hot.");
break;
case HOT:
case FLAMING:
default:
System.out.println("maybe too hot.");
}
}
public static void main(String[] args) {
Burrito plain = new Burrito(Spiciness.NOT), greenChile = new Burrito(
Spiciness.MEDIUM), jalapeno = new Burrito(Spiciness.HOT);
plain.describe();
greenChile.describe();
jalapeno.describe();
}
}