-
Notifications
You must be signed in to change notification settings - Fork 131
Expand file tree
/
Copy pathCoffee.java
More file actions
49 lines (42 loc) · 1.02 KB
/
Coffee.java
File metadata and controls
49 lines (42 loc) · 1.02 KB
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
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
package com.booleanuk.core;
public class Coffee implements Item {
private String variant;
private String name;
private String sku;
private float price;
public Coffee(String variant) {
this.variant = variant.toUpperCase();
this.name = "Coffee";
this.price = 1.29F;
setRest();
}
private void setRest(){
switch (this.variant) {
case "BLACK" -> {
this.price = 0.99F;
this.sku = "COFB";
}
case "WHITE" -> {
this.price = 1.19F;
this.sku = "COFW";
} case "CAPUCCINO" -> this.sku = "COFC";
case "LATTE" -> this.sku = "COFL";
}
}
@Override
public String getVariant() {
return this.variant;
}
@Override
public float getPrice() {
return this.price;
}
@Override
public String getSku() {
return this.sku;
}
@Override
public String getName() {
return this.name;
}
}