-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathCafe.java
44 lines (44 loc) · 1.06 KB
/
Cafe.java
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
import java.util.Scanner;
public class Cafe extends Item{
protected String nom = "Boisson chaude";
protected int prix = 5;
protected CafeCategory categorie;
public Cafe(){
String option;
Scanner sc = new Scanner(System.in);
boolean quitter = true;
do{
System.out.println("CHOISISSEZ UNE CATEGORIE DE BOISSON CHAUDE");
System.out.println("-----------------------------------------");
System.out.println("1. Coffe\n2. Thea\n3. Chocolate\n4. Quitter");
System.out.print(">>> ");
option = sc.nextLine();
switch (option){
case "1":
this.categorie = new Coffe();
quitter = true;
break;
case "2":
this.categorie = new Thea();
quitter = true;
break;
case "3":
this.categorie = new Chocolate();
quitter = true;
break;
case "4":
quitter = true;
break;
default:
System.out.println("Option invalide");
quitter = false;
}
}while(!quitter);
}
public float getPrix(){
return this.prix;
}
public String getItemType(){
return this.getClass().getName()+"->"+this.categorie.getClass().getName();
}
}