-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathCoffee.java
More file actions
29 lines (26 loc) · 1.26 KB
/
Coffee.java
File metadata and controls
29 lines (26 loc) · 1.26 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
public class Coffee {
/*
Schreibt Kaffee in Konsole
*/
public static void printer(CaffeineInfusedBeverage c){
System.out.printf("%s (%.2f EUR)%n", c.getDescription(), c.cost());
}
public static void main(String[] args) {
CaffeineInfusedBeverage espressoWithMilk = new Milk(true, new Espresso());
CaffeineInfusedBeverage espressoWithSoyMilk = new SoyMilk(new Espresso());
CaffeineInfusedBeverage cappuccinoWithMilk = new Milk(new Cappuccino());
CaffeineInfusedBeverage cappuccinoWithMilkSugar = new Milk(true, new Sugar(new Cappuccino()));
CaffeineInfusedBeverage espressoWithHazelnutMilk = new HazelnutMilk(true, new Espresso());
CaffeineInfusedBeverage americanoWithHazelnutMilkSugar = new HazelnutMilk(true, new Sugar(new Americano()));
CaffeineInfusedBeverage latteMacchiatoWithSugar = new Sugar(new LatteMacchiato());
CaffeineInfusedBeverage espresso = new Espresso();
printer(espresso);
printer(espressoWithMilk);
printer(espressoWithSoyMilk);
printer(espressoWithHazelnutMilk);
printer(cappuccinoWithMilk);
printer(cappuccinoWithMilkSugar);
printer(americanoWithHazelnutMilkSugar);
printer(latteMacchiatoWithSugar);
}
}