From a4e4c25dcddee28dfb59f0ad5922a7b79635d75b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?R=C3=A9mi=20Heredero?= Date: Sun, 28 Nov 2021 12:26:36 +0100 Subject: [PATCH] --- .../C081_Enum/App.java | 29 ++++++++++++++++++- .../C081_Enum/Cat.java | 5 ---- .../C081_Enum/Glace.java | 5 ---- 3 files changed, 28 insertions(+), 11 deletions(-) delete mode 100644 src/C08_Structures_de_donnees/C081_Enum/Cat.java delete mode 100644 src/C08_Structures_de_donnees/C081_Enum/Glace.java diff --git a/src/C08_Structures_de_donnees/C081_Enum/App.java b/src/C08_Structures_de_donnees/C081_Enum/App.java index 7eedc64..37d8487 100644 --- a/src/C08_Structures_de_donnees/C081_Enum/App.java +++ b/src/C08_Structures_de_donnees/C081_Enum/App.java @@ -1,6 +1,33 @@ package C08_Structures_de_donnees.C081_Enum; + +enum Glace {VANILLE, CHOCOLAT, FRAISE, MANGUE}; +// enum Cat {MINOU, CHATONS, CONNAIS_PAS_D_AUTRES, TOTO}; public class App { public static void main(String[] args) throws Exception { - System.out.println("Hello, World!"); + + Glace favorite = Glace.VANILLE; + // Cat simba = Cat.CHATONS; + for (int i = 0; i < 4; i++) { + switch (favorite) { + case VANILLE: + System.out.println("Vanille"); + favorite = Glace.CHOCOLAT; + break; + + case CHOCOLAT: + System.out.println("Chocolat"); + favorite = Glace.FRAISE; + break; + + case FRAISE: + System.out.println("Fraise"); + favorite = Glace.MANGUE; + + default: + System.out.println("Mangue"); + favorite = Glace.VANILLE; + break; + } + } } } diff --git a/src/C08_Structures_de_donnees/C081_Enum/Cat.java b/src/C08_Structures_de_donnees/C081_Enum/Cat.java deleted file mode 100644 index 52a6489..0000000 --- a/src/C08_Structures_de_donnees/C081_Enum/Cat.java +++ /dev/null @@ -1,5 +0,0 @@ -package C08_Structures_de_donnees.C081_Enum; - -public class Cat { - -} diff --git a/src/C08_Structures_de_donnees/C081_Enum/Glace.java b/src/C08_Structures_de_donnees/C081_Enum/Glace.java deleted file mode 100644 index 4f9aac7..0000000 --- a/src/C08_Structures_de_donnees/C081_Enum/Glace.java +++ /dev/null @@ -1,5 +0,0 @@ -package C08_Structures_de_donnees.C081_Enum; - -public class Glace { - -}