From d3ab9caf7aa0a8026888c86222e642bff2973c5a Mon Sep 17 00:00:00 2001
From: Baptiste Royer <baptiste.royer.etu@univ-lille.fr>
Date: Mon, 3 Jun 2024 09:23:11 +0200
Subject: [PATCH] Ajout tp09

---
 Ordonnanceur.java                             |   3 +
 bin/TP04/Exercice_3/Container.class           | Bin 0 -> 1138 bytes
 bin/TP04/Exercice_3/ExtendedException.class   | Bin 0 -> 250 bytes
 bin/TP04/Exercice_3/Thing.class               | Bin 0 -> 1997 bytes
 bin/TP04/Exercice_3/UseThing.class            | Bin 0 -> 1284 bytes
 .../TP04/Exercice_1/Exemple1/Exemple1.java    |   2 +-
 .../Exercice_1/Exemple2/Dutilisation.java     |   2 +-
 .../TP04/Exercice_1/Exemple2/MyException.java |   2 +-
 .../TP04/Exercice_1/Exemple3/Exemple3.java    |   4 +-
 .../TP04/Exercice_1/Exemple4/Exemple4.java    |   2 +-
 .../TP04/Exercice_1/Exemple5/Exemple5.java    |   2 +-
 .../TP04/Exercice_1/Exemple6/Exemple6.java    |   2 +-
 src/TP04/Exercice_2/Exercice2.java            |  29 +++++++
 src/TP04/Exercice_3/Container.java            |  17 +++++
 src/TP04/Exercice_3/ExtendedException.java    |   7 ++
 src/TP04/Exercice_3/Thing.java                |  71 ++++++++++++++++++
 src/TP04/Exercice_3/UseThing.java             |  14 ++++
 src/TP04/Exercice_4/Competitor.java           |  49 ++++++++++++
 src/TP04/Exercice_4/Country.java              |  20 +++++
 src/TP04/Exercice_4/NumAuto.java              |   9 +++
 src/TP04/Exercice_4/Team.java                 |   7 ++
 src/tp04/Person.java                          |   1 -
 22 files changed, 234 insertions(+), 9 deletions(-)
 create mode 100644 Ordonnanceur.java
 create mode 100644 bin/TP04/Exercice_3/Container.class
 create mode 100644 bin/TP04/Exercice_3/ExtendedException.class
 create mode 100644 bin/TP04/Exercice_3/Thing.class
 create mode 100644 bin/TP04/Exercice_3/UseThing.class
 rename "src/TP04/Exercice n\302\2601/Exemple1/Exemple1.java" => src/TP04/Exercice_1/Exemple1/Exemple1.java (83%)
 rename "src/TP04/Exercice n\302\2601/Exemple2/Dutilisation.java" => src/TP04/Exercice_1/Exemple2/Dutilisation.java (77%)
 rename "src/TP04/Exercice n\302\2601/Exemple2/MyException.java" => src/TP04/Exercice_1/Exemple2/MyException.java (79%)
 rename "src/TP04/Exercice n\302\2601/Exemple3/Exemple3.java" => src/TP04/Exercice_1/Exemple3/Exemple3.java (79%)
 rename "src/TP04/Exercice n\302\2601/Exemple4/Exemple4.java" => src/TP04/Exercice_1/Exemple4/Exemple4.java (91%)
 rename "src/TP04/Exercice n\302\2601/Exemple5/Exemple5.java" => src/TP04/Exercice_1/Exemple5/Exemple5.java (86%)
 rename "src/TP04/Exercice n\302\2601/Exemple6/Exemple6.java" => src/TP04/Exercice_1/Exemple6/Exemple6.java (93%)
 create mode 100644 src/TP04/Exercice_2/Exercice2.java
 create mode 100644 src/TP04/Exercice_3/Container.java
 create mode 100644 src/TP04/Exercice_3/ExtendedException.java
 create mode 100644 src/TP04/Exercice_3/Thing.java
 create mode 100644 src/TP04/Exercice_3/UseThing.java
 create mode 100644 src/TP04/Exercice_4/Competitor.java
 create mode 100644 src/TP04/Exercice_4/Country.java
 create mode 100644 src/TP04/Exercice_4/NumAuto.java
 create mode 100644 src/TP04/Exercice_4/Team.java

diff --git a/Ordonnanceur.java b/Ordonnanceur.java
new file mode 100644
index 0000000..7b6a340
--- /dev/null
+++ b/Ordonnanceur.java
@@ -0,0 +1,3 @@
+public class Ordonnanceur {
+    
+}
\ No newline at end of file
diff --git a/bin/TP04/Exercice_3/Container.class b/bin/TP04/Exercice_3/Container.class
new file mode 100644
index 0000000000000000000000000000000000000000..1c486834de9d266e5fdcfc47263e547efd1c6298
GIT binary patch
literal 1138
zcmX^0Z`VEs1_oOOYjy@EMh3}{00R?!*NW7l<jmyMcw>F%{JfIH%)HbhP6kE>79Ivx
z1~x_pb|)Xt;1Jg!Mh0mgoEoe_IyiV3I6*p?o%|y}d~O~F9uS|^Imj`@6(qvP!@$oV
zz{tR^66WX=>Ke?*AQO$pP%Z``24Qvv0Uibs22n-^*5sW0yi`U85e-eBti-ZJ{hY+S
zbbbG%tkmQZYc2+H1_^csNgf6%25CkHK7<0-ywY4o2KKVVoYGYPG)4wf4J6&pIf=!^
z)<^=uB}JKe>DI_LfD8beFU!Lq#~{zhz-E(~msw)R$RLJn6jZ0DW*Eq;iaZQT49biQ
z9Lb3ViOHEIm5dCGo*WFUTnvm1Y9Mpe85zW}Y4_9&<6z+AVBi6%)aGH(VbBEy7})v6
zj0|!bn)rf@k%0}SlEpbcC6$qZ-zPIK)vq)+DYYmhF)1gNkwG7ewVHUMfsuhTI5Ryj
zv81#pm63r(!&5Vik%2oswZs|jHD(P>Peuj~o8%m5$S`Yw6zL)bEGQIh@YrH!&B(wN
zoL^d$oa&YdawZ=<IqHET)4`B|kwKh+fq~UQ5|lC-7#t))=?zTtFt9N&FbIKyoPj|=
z3Y5wi7#P?XI2rU9bQu^K^cff!lo%KpK!9r#1MfBl!2=9J8yFZE7#R$}DnWA044e#7
z3?O?T>Y2bgxP%zBb})z?U|_^l&%_|dpw7SqHeZK<nSq6Yfq_R$TV^|hjF#+H28E4q
z8~7NQ85kJ27}yxN8MqmE7>pPg7?>E085kK%7)+rqlx1K9+sLZ5g+XBrTq_$`kY9ic
zlop^$^}$v#Fo?75WnheC-o(Hh9LchYfju~qbrS<uFs4g67|a;Vp_;=PSU~~7V7!}w
zF;Yl{nPoeJ>ShLJFi(R;fD6oJ2Xi%91&qL4t{n_on;Cc!9ufk(fQ5mNft5j)fsFy=
PeI}^4EEp`o-m?M#<iFS#

literal 0
HcmV?d00001

diff --git a/bin/TP04/Exercice_3/ExtendedException.class b/bin/TP04/Exercice_3/ExtendedException.class
new file mode 100644
index 0000000000000000000000000000000000000000..97c6bbf6892b135335b955043aa1a5bedbfb9d37
GIT binary patch
literal 250
zcmX^0Z`VEs1_oOOUM>bE24;2!79Ivx1~x_p;jF~6ME#t^ymWonisaOSlFa-(Mg}&U
z%)HDJJ4Oak4IhMp;F6-uymV{LFm?tGMh3-@00R?!*NW7l<jmyMcw>Fnijvg4l++X?
zb6A}7Q&Jfj_<b_-QvFJElTwR95|eUL85y{O^Gl18Q{6H_95D=?dLT;~6dBkVm>58S
zk%1B9Tn0u4P6h@BB?cz2IGdLCb_T|c3=9m63|tHh3?Q#DFt9>Zax*Y6Ffs4|012cw
Ad;kCd

literal 0
HcmV?d00001

diff --git a/bin/TP04/Exercice_3/Thing.class b/bin/TP04/Exercice_3/Thing.class
new file mode 100644
index 0000000000000000000000000000000000000000..595c3d58f47d94309b0ea6c0ef71f7f00a699d8b
GIT binary patch
literal 1997
zcmX^0Z`VEs1_oP(P%Z{024;2!79Ivx1~x_pfvm)`ME#t^ymWp4q^#8B5=I6#o6Nk-
z5<5l)W)00SP6iGJPId+^9tLg(9!3VykN^V{eb<WAqU6lv)Och4kc`Z{bVdf2yu{p8
zMg}1tgmJ+oMVWc&)*u7;co_H@1Q;1O3QH67N-|3-85tNoK@vhd48jZ|j0~K~`FSOY
znR%&2j11B~=yo{6B&~%Q7#PHO7{nPQ7#YNK6SGsD^YfAuOTsftGMw}Cic1pnN{Sg7
zoHQ_<;fcpoO-$un3{niz><ltI46+Pzj0}=Eoy5q%ot|3aoLG>U4E7hZhNdSwg90Oi
zBDxmWijvg4l++a0isaOSlFa-(4hAJg29-c)kSLVo=PP7nre`RW<SV3QmMCQADU@WS
zDkSAs=y5T~GpK+fOqG#A6pQCH!$9s;=V8zQIhH-YC?zv5F$W~3#lxV@pu@<(R+gAk
znp(`rAg7@jjVCC$7&sX8co_6S=72l~a~(+BkcYvD!I+VOyEwH3CeFyfqT#6-#>ilZ
z#aVd6JdBZn#W_DEm63tpCo?bAuQWF)wJ0PpDJPYYfjvF7#1EXHL^QBO4kH5(D9mB0
zf{{U1Llcjm7#Y}$Vdn7^r<TBz6DTzB=mU9+qa+`aju{zvgG&;Vvwaf_ppN8%M`ST0
zgJeljVqS4tYEekOPhwGeY7vqp%o>_ej10_)DJhH$T*3LJMaijdnILa+fisUDD9bQ1
z2sq{EmlT&2B^LOmmSp6o6!Wt&cyKXzGI+5wc!QF>4<myLNGT+<X6BXUXQ%2z90$n-
zZi&ey`9+nC3^S190;&*Vs7GR6N=|CAicfxic4>h%X1YfbLD3jeS&)iFc{GxGNbzBf
z9A8i)oD*|$f-_4}tvML{7#TFczODup7`Ez+>N*OrLcx|%M*&_A*fQ2KGVplj<)s!m
z=Oh*vrxvp_1Tr$HVuS!TkFhfZGcw5GSIWr11_=cQMFtKACI$uuW(FouA;-YLzyvC;
zz_c)f2m=EH7Xu>$D}xCGBZDae1A`3%69Wqa1A~axb_PZ*?X3*#S~6Q1c(ru5G6-&D
zU|?WmFas4+46F<c3>*wB44e#{3|tI+4BQOD3_J{s4CV|LP?KaC7#SED7#LW!wlJ`7
zfNNy~3-U8Cg7P62rMzp<lnOI2GFUQLVNoiGZmKu~BZD=ADpaWw0~6TmY+!F791p4_
z7#O4(SQ%s(7#VCBY_X|F@+?HXJOe9(0s|w19o&Oj49sA^2!TAPwS|FKYYT(mE(TEs
z26T6+Fff8j7X~J95c_~5gMmR#8l+(xgX9thZY}Ap47|%3cy}|%M+zx!XHeb`axW7&
zu!X=8qQk(=pvxf4pwA%7V8~$4z`(%5z$DDc-~eVZGRQM9GB`3gLH!cMzyfxgD#Qx4
z9SoZLSW*@+urjaF+QFa+6=g{<+R7lv0t#_tt4tUK7)%+27|a=z87#n7F*7g<F)%VX
zGZ;htpbqr|x0bZlHU`~<Z43q=2SZW^B*1JKxEO4aoX5=I0#0?V3~u1G!^q&yz{uds
P;15lM0SrM5Aq<iL%pbW!

literal 0
HcmV?d00001

diff --git a/bin/TP04/Exercice_3/UseThing.class b/bin/TP04/Exercice_3/UseThing.class
new file mode 100644
index 0000000000000000000000000000000000000000..c562c41325a67f63f4a2c9f464cb1d5f2c111154
GIT binary patch
literal 1284
zcmX^0Z`VEs1_oOOcP<7d24;2!79Ivx1~x_pfvm)`ME#t^ymWp4q^#8B5=I6#o6Nk-
z5<5l)W)00Sb_Nbc2GNiJ0~3AMiqxXy%;eN~WBrhf%)E3C1};Vhj?%nTFpraghk=)!
zfscoQpFx0;K@weybADb)VrE`y5hDY$lYaywgR~D$CDvRF><mI67YZ{n7;5+++!$O^
zl$n=q?TJUPW*8@fD1#U~gE$X^1cM}s7lSK{OHy+g8JP1+OBfkMAqHpW>jxBN=9L7O
z6s0EST5~Z-Gsv(r$nr4AF~~DA2!kz0Rl~@@UI5aOlgG#)itIc{5L#=7fjpqd!=S{V
z%*eo;n3BTCz@p))879QQz@W;*pvIui$RM7Zn4RjJpO>6i5}sL-;hdjWT#}eqQq0Jp
zt%2b^a1dK-LL3Z^Eoex9T&oFksur44pz@kw91J>)4D7jyU?bQW^cWc=&;vfS7!rq!
z3@pz1DXEMM{63j^seYxoNvTC4iAg!Bj0`NfiJ5tf3}PD5m~PMvV`SiRtw>HSD9Oyv
zD`safWn@r9x5KrfBsDK3H3hDYk%22XzqBYh)h!cb0WZuEdY}MjWDs!5&o3!1DM~Ex
zO)bgDPbubSW3b|4ux7AfXRrkYp&cWG3P>p=@n+_g<!7hrLwpShRky_ClKi4dMur*4
zQ3O>8G1Mb5FC{0nSj8tlKfAQR8q;e?A}AU|DhpDvC`S$)SX#g|!Z|S~Cpfbt)tZCB
zfsuiUk&BUm$1^W4wa7UqvA8(3n4Q6ykwF#1Z`hp7&fv<(ActQmBLf@6e+-HYx(rMV
zAi%`H2+IEqj12k=3=Faij0}tn3=FJV+Zh-)GB7YOG8iy0FtC9InHe}43>l0Vn7~Rq
z7+4vY85kG>b~CU?3URV+V&LA+An3D+K}35SgOs*_$TkKA5N8*I3IoG71`V(>Z2=yL
zI^RtUB0Ad`q;v#qAnJ5r>JYZ7F>r#M!obJC#vsbT&LGXe!Jy8-$zaC7#bC?8&EU+y
z!{E=r%V5mFz`(-5$Y8?2%wWdAz`(>{&S1g7z`()4$Y9C9$Y9Ul$iTqB#lXnm#Nfi<
H#vlm*l{!RJ

literal 0
HcmV?d00001

diff --git "a/src/TP04/Exercice n\302\2601/Exemple1/Exemple1.java" b/src/TP04/Exercice_1/Exemple1/Exemple1.java
similarity index 83%
rename from "src/TP04/Exercice n\302\2601/Exemple1/Exemple1.java"
rename to src/TP04/Exercice_1/Exemple1/Exemple1.java
index f3e9569..095f73a 100644
--- "a/src/TP04/Exercice n\302\2601/Exemple1/Exemple1.java"	
+++ b/src/TP04/Exercice_1/Exemple1/Exemple1.java
@@ -1,4 +1,4 @@
-package TP04.Exemple1;
+package TP04.Exercice_1.Exemple1;
 
 
 public class Exemple1 {
diff --git "a/src/TP04/Exercice n\302\2601/Exemple2/Dutilisation.java" b/src/TP04/Exercice_1/Exemple2/Dutilisation.java
similarity index 77%
rename from "src/TP04/Exercice n\302\2601/Exemple2/Dutilisation.java"
rename to src/TP04/Exercice_1/Exemple2/Dutilisation.java
index 26ecfde..053f4a8 100644
--- "a/src/TP04/Exercice n\302\2601/Exemple2/Dutilisation.java"	
+++ b/src/TP04/Exercice_1/Exemple2/Dutilisation.java
@@ -1,4 +1,4 @@
-package TP04.Exemple2;
+package TP04.Exercice_1.Exemple2;
 
 public class Dutilisation {
     public void example2() throws MyException {
diff --git "a/src/TP04/Exercice n\302\2601/Exemple2/MyException.java" b/src/TP04/Exercice_1/Exemple2/MyException.java
similarity index 79%
rename from "src/TP04/Exercice n\302\2601/Exemple2/MyException.java"
rename to src/TP04/Exercice_1/Exemple2/MyException.java
index 1252534..4e80c52 100644
--- "a/src/TP04/Exercice n\302\2601/Exemple2/MyException.java"	
+++ b/src/TP04/Exercice_1/Exemple2/MyException.java
@@ -1,4 +1,4 @@
-package TP04.Exemple2;
+package TP04.Exercice_1.Exemple2;
 
 public class MyException extends Exception {
     public MyException() {}
diff --git "a/src/TP04/Exercice n\302\2601/Exemple3/Exemple3.java" b/src/TP04/Exercice_1/Exemple3/Exemple3.java
similarity index 79%
rename from "src/TP04/Exercice n\302\2601/Exemple3/Exemple3.java"
rename to src/TP04/Exercice_1/Exemple3/Exemple3.java
index 2f5fe15..5e33644 100644
--- "a/src/TP04/Exercice n\302\2601/Exemple3/Exemple3.java"	
+++ b/src/TP04/Exercice_1/Exemple3/Exemple3.java
@@ -1,6 +1,6 @@
-package TP04.Exemple3;
+package TP04.Exercice_1.Exemple3;
 
-import TP04.Exemple2.MyException;
+import TP04.Exercice_1.Exemple2.MyException;
 
 public class Exemple3 {
     public void doItAgain() throws MyException {
diff --git "a/src/TP04/Exercice n\302\2601/Exemple4/Exemple4.java" b/src/TP04/Exercice_1/Exemple4/Exemple4.java
similarity index 91%
rename from "src/TP04/Exercice n\302\2601/Exemple4/Exemple4.java"
rename to src/TP04/Exercice_1/Exemple4/Exemple4.java
index c12f108..136022f 100644
--- "a/src/TP04/Exercice n\302\2601/Exemple4/Exemple4.java"	
+++ b/src/TP04/Exercice_1/Exemple4/Exemple4.java
@@ -1,4 +1,4 @@
-package TP04.Exemple4;    
+package TP04.Exercice_1.Exemple4;    
     
 public class Exemple4 {    
     public int example4() {
diff --git "a/src/TP04/Exercice n\302\2601/Exemple5/Exemple5.java" b/src/TP04/Exercice_1/Exemple5/Exemple5.java
similarity index 86%
rename from "src/TP04/Exercice n\302\2601/Exemple5/Exemple5.java"
rename to src/TP04/Exercice_1/Exemple5/Exemple5.java
index 7b1389e..f128c79 100644
--- "a/src/TP04/Exercice n\302\2601/Exemple5/Exemple5.java"	
+++ b/src/TP04/Exercice_1/Exemple5/Exemple5.java
@@ -1,4 +1,4 @@
-package TP04.Exemple5;
+package TP04.Exercice_1.Exemple5;
 
 public class Exemple5 {
     public void example5() {
diff --git "a/src/TP04/Exercice n\302\2601/Exemple6/Exemple6.java" b/src/TP04/Exercice_1/Exemple6/Exemple6.java
similarity index 93%
rename from "src/TP04/Exercice n\302\2601/Exemple6/Exemple6.java"
rename to src/TP04/Exercice_1/Exemple6/Exemple6.java
index 3f5eec0..b270f99 100644
--- "a/src/TP04/Exercice n\302\2601/Exemple6/Exemple6.java"	
+++ b/src/TP04/Exercice_1/Exemple6/Exemple6.java
@@ -1,4 +1,4 @@
-package TP04.Exemple6;
+package TP04.Exercice_1.Exemple6;
 
 public class Exemple6 {
     public static void main(String[] args) {
diff --git a/src/TP04/Exercice_2/Exercice2.java b/src/TP04/Exercice_2/Exercice2.java
new file mode 100644
index 0000000..9fa825f
--- /dev/null
+++ b/src/TP04/Exercice_2/Exercice2.java
@@ -0,0 +1,29 @@
+package TP04.Exercice_2;
+
+import java.util.Scanner;
+
+public class Exercice2 {
+
+    class LocalKeyboard {
+        public static int readInt(String message) {
+            Scanner scanner = new Scanner(System.in);
+            System.out.println(message);
+            int r = scanner.nextInt();
+            scanner.close();
+            return r;            
+        }
+    }
+
+    public static int[] tab = {17, 12, 15, 38, 29, 157, 89, -22, 0, 5};
+
+    public static int division(int index, int divisor) {
+        return tab[index]/divisor;
+    }
+
+    public static void statement() {
+        int x, y;
+        x = LocalKeyboard.readInt("Write the index of the integer to divide: ");
+        y = LocalKeyboard.readInt("Write the divisor: ");
+        System.out.println("The result is: " + division(x,y));
+    }
+}
\ No newline at end of file
diff --git a/src/TP04/Exercice_3/Container.java b/src/TP04/Exercice_3/Container.java
new file mode 100644
index 0000000..71b5413
--- /dev/null
+++ b/src/TP04/Exercice_3/Container.java
@@ -0,0 +1,17 @@
+package TP04.Exercice_3;
+
+public enum Container {
+    BLISTER(1),
+    BOX(10),
+    CRATE(50);
+
+    private final int capacity;
+
+    Container(int capacity) {
+        this.capacity = capacity;
+    }
+
+    public int getCapacity() {
+        return this.capacity;
+    }
+}
\ No newline at end of file
diff --git a/src/TP04/Exercice_3/ExtendedException.java b/src/TP04/Exercice_3/ExtendedException.java
new file mode 100644
index 0000000..30b844b
--- /dev/null
+++ b/src/TP04/Exercice_3/ExtendedException.java
@@ -0,0 +1,7 @@
+package TP04.Exercice_3;
+
+public class ExtendedException extends Exception {
+    public ExtendedException(String message) {
+        super(message);
+    }
+}
\ No newline at end of file
diff --git a/src/TP04/Exercice_3/Thing.java b/src/TP04/Exercice_3/Thing.java
new file mode 100644
index 0000000..2a83928
--- /dev/null
+++ b/src/TP04/Exercice_3/Thing.java
@@ -0,0 +1,71 @@
+package TP04.Exercice_3;
+
+public class Thing {
+    private String name;
+    private int quantity;
+    private Container container;
+
+    public Thing(String name, int quantity, Container container) {
+        this.name = name;
+        this.quantity = quantity;
+        this.container = container;
+    }
+
+    public String getName() {
+        return name;
+    }
+
+    public int getQuantity() {
+        return quantity;
+    }
+
+    public Container getContainer() {
+        return container;
+    }
+
+    public void setName(String name) {
+        this.name = name;
+    }
+
+    public void setContainer(Container container) {
+        this.container = container;
+    }
+
+    @Override
+    public String toString() {
+        return "Thing{" +
+                "name='" + name + '\'' +
+                ", quantity=" + quantity +
+                ", container=" + container +
+                '}';
+    }
+
+    public void setQuantity(int value) throws ExtendedException {
+        try {
+            if(value < this.container.getCapacity()) {
+                this.quantity = value;
+            } else {
+                throw new ExtendedException("Quantity too high to fit in the box.");
+            }
+        } catch(ExtendedException e) {
+            System.out.println("Addition Impossible !");
+        }
+    }
+
+    public boolean transferToLargerContainer() {
+        if (this.container.ordinal() == Container.values().length - 1) {
+            return false;
+        }
+        this.container = Container.values()[this.container.ordinal() + 1];
+        return true;
+    }
+
+    public void add(int value) throws ExtendedException {
+        try {
+            setQuantity(value + this.getQuantity());
+        } catch(ExtendedException e) {
+            transferToLargerContainer();
+            setQuantity(value + this.getQuantity());
+        }
+    }
+}
\ No newline at end of file
diff --git a/src/TP04/Exercice_3/UseThing.java b/src/TP04/Exercice_3/UseThing.java
new file mode 100644
index 0000000..be61168
--- /dev/null
+++ b/src/TP04/Exercice_3/UseThing.java
@@ -0,0 +1,14 @@
+package TP04.Exercice_3;
+
+public class UseThing {
+    public static void main(String[] args) throws ExtendedException {
+        Thing ch1 = new Thing("uneThing", 3, Container.BOX);
+        System.out.println(ch1);
+        ch1.add(20);
+        System.out.println(ch1 + "\n");
+        Thing ch2 = new Thing("maThing", 12, Container.BOX);
+        System.out.println(ch2);
+        ch2.add(60);
+        System.out.println(ch2 + "\n");
+    }
+}
\ No newline at end of file
diff --git a/src/TP04/Exercice_4/Competitor.java b/src/TP04/Exercice_4/Competitor.java
new file mode 100644
index 0000000..185253d
--- /dev/null
+++ b/src/TP04/Exercice_4/Competitor.java
@@ -0,0 +1,49 @@
+package TP04.Exercice_4;
+
+
+public class Competitor {
+    private int ID;
+    private final String NAME;
+    private Country nationality;
+    private Team team;
+
+    public Competitor(String name, Country nationality, Team team) {
+        NumAuto temp = new NumAuto();
+        this.ID = temp.getID();
+        this.NAME = name;
+        this.nationality = nationality;
+        this.team = team;
+    }
+
+    public int getID() {
+        return this.ID;
+    }
+
+    public String getName() {
+        return this.NAME;
+    }
+
+    public Country getCountry() {
+        return this.nationality;
+    }
+
+    public Team getTeam() {
+        return this.team;
+    }
+
+    public String toString() {
+        return this.ID + " - " + this.NAME + " (" + this.nationality.getCode() + ") -> " + this.team.toString();
+    }
+
+    public boolean isFrom(Team team) {
+        return this.team == team;
+    }
+
+    public boolean isFrom(Country country) {
+        return this.nationality == country;
+    }
+
+    public boolean equals(int ID) {
+        return this.ID == ID;
+    }
+}
\ No newline at end of file
diff --git a/src/TP04/Exercice_4/Country.java b/src/TP04/Exercice_4/Country.java
new file mode 100644
index 0000000..7fa1f59
--- /dev/null
+++ b/src/TP04/Exercice_4/Country.java
@@ -0,0 +1,20 @@
+package TP04.Exercice_4;
+
+public enum Country {
+    FRANCE("FR"),
+    GERMANY("GE"),
+    RUSSIA("RU"),
+    SWEDEN("SW"),
+    AUSTRIA("AU"),
+    ITALY("IT");
+
+    private String code;
+
+    Country(String code) {
+        this.code = code;
+    }
+
+    public String getCode() {
+        return this.code;
+    }
+}
\ No newline at end of file
diff --git a/src/TP04/Exercice_4/NumAuto.java b/src/TP04/Exercice_4/NumAuto.java
new file mode 100644
index 0000000..34defd7
--- /dev/null
+++ b/src/TP04/Exercice_4/NumAuto.java
@@ -0,0 +1,9 @@
+package TP04.Exercice_4;
+
+public class NumAuto {
+    private static int ID = 0;
+
+    public int getID() {
+        return ++ID;
+    }
+}
\ No newline at end of file
diff --git a/src/TP04/Exercice_4/Team.java b/src/TP04/Exercice_4/Team.java
new file mode 100644
index 0000000..dee5c20
--- /dev/null
+++ b/src/TP04/Exercice_4/Team.java
@@ -0,0 +1,7 @@
+package TP04.Exercice_4;
+
+public enum Team {
+    TEAM_1,
+    TEAM_2,
+    TEAM_3;
+}
\ No newline at end of file
diff --git a/src/tp04/Person.java b/src/tp04/Person.java
index b6e4a6e..89c22a9 100644
--- a/src/tp04/Person.java
+++ b/src/tp04/Person.java
@@ -1,6 +1,5 @@
 package tp04;
 
-import tp04.NumeroAutomatique;
 
 public class Person {
     private int ID;
-- 
GitLab