diff --git a/2A/Java/tp/1_tp/TP1.mdj b/2A/Java/tp/1_tp/TP1.mdj index 5eb805d..8a0fdf6 100755 --- a/2A/Java/tp/1_tp/TP1.mdj +++ b/2A/Java/tp/1_tp/TP1.mdj @@ -1011,7 +1011,7 @@ "top": 423, "width": 164.41064453125, "height": 13, - "text": "+toString()", + "text": "+toString(p: Patient)", "horizontalAlignment": 0 } ], @@ -1369,7 +1369,7 @@ "font": "Arial;13;0", "left": 503, "top": 240, - "width": 12.65087890625, + "width": 13.83154296875, "height": 13, "alpha": 0.12306859015170946, "distance": 88.61715409558128, @@ -2331,7 +2331,20 @@ "_parent": { "$ref": "AAAAAAGLW6+k0yIUSUI=" }, - "name": "toString" + "name": "toString", + "parameters": [ + { + "_type": "UMLParameter", + "_id": "AAAAAAGLW8r4g0Atc1M=", + "_parent": { + "$ref": "AAAAAAGLW7PN2SzOuyo=" + }, + "name": "p", + "type": { + "$ref": "AAAAAAGLW588ex/TTbE=" + } + } + ] } ] }, diff --git a/2A/Java/tp/1_tp/TP1/src/models/Patient.java b/2A/Java/tp/1_tp/TP1/src/models/Patient.java index 0c13707..17e8d42 100755 --- a/2A/Java/tp/1_tp/TP1/src/models/Patient.java +++ b/2A/Java/tp/1_tp/TP1/src/models/Patient.java @@ -1,3 +1,3 @@ package models; -public record Patient(String nom, String prenom, int age) {} +public record Patient(String nom, String prenom, int age) {} \ No newline at end of file diff --git a/2A/Java/tp/2_tp/.idea/.gitignore b/2A/Java/tp/2_tp/.idea/.gitignore new file mode 100644 index 0000000..e69de29 diff --git a/2A/Java/tp/2_tp/.idea/2_tp.iml b/2A/Java/tp/2_tp/.idea/2_tp.iml new file mode 100644 index 0000000..d6ebd48 --- /dev/null +++ b/2A/Java/tp/2_tp/.idea/2_tp.iml @@ -0,0 +1,9 @@ + + + + + + + + + \ No newline at end of file diff --git a/2A/Java/tp/2_tp/.idea/misc.xml b/2A/Java/tp/2_tp/.idea/misc.xml new file mode 100644 index 0000000..639900d --- /dev/null +++ b/2A/Java/tp/2_tp/.idea/misc.xml @@ -0,0 +1,6 @@ + + + + + + \ No newline at end of file diff --git a/2A/Java/tp/2_tp/.idea/modules.xml b/2A/Java/tp/2_tp/.idea/modules.xml new file mode 100644 index 0000000..5be316b --- /dev/null +++ b/2A/Java/tp/2_tp/.idea/modules.xml @@ -0,0 +1,8 @@ + + + + + + + + \ No newline at end of file diff --git a/2A/Java/tp/2_tp/.idea/vcs.xml b/2A/Java/tp/2_tp/.idea/vcs.xml new file mode 100644 index 0000000..4fce1d8 --- /dev/null +++ b/2A/Java/tp/2_tp/.idea/vcs.xml @@ -0,0 +1,6 @@ + + + + + + \ No newline at end of file diff --git a/2A/Java/tp/2_tp/.idea/workspace.xml b/2A/Java/tp/2_tp/.idea/workspace.xml new file mode 100644 index 0000000..e339c70 --- /dev/null +++ b/2A/Java/tp/2_tp/.idea/workspace.xml @@ -0,0 +1,38 @@ + + + + + + + + + + + + + + + + + + + 1698394730221 + + + + \ No newline at end of file diff --git a/2A/Java/tp/2_tp/Sujet.txt b/2A/Java/tp/2_tp/Sujet.txt new file mode 100644 index 0000000..0f7ce53 --- /dev/null +++ b/2A/Java/tp/2_tp/Sujet.txt @@ -0,0 +1,2 @@ +developper une app permettant a un gestionnaire de zoo de gerer les entrées sorties d'animaux dans son zoo. Il pourra a tout moment afficher l'etat (les infos) des animaux. En hiver, les animaux hiverne. + les oiseaux (cigogne, peroquet, ...) migrent du nord au sud du zoo. Les animaux à fourrure (ours, loups, ...) augmentent la densité de leur pelage. diff --git a/2A/Java/tp/2_tp/TP2.mdj b/2A/Java/tp/2_tp/TP2.mdj new file mode 100644 index 0000000..65e8560 --- /dev/null +++ b/2A/Java/tp/2_tp/TP2.mdj @@ -0,0 +1,26 @@ +{ + "_type": "Project", + "_id": "AAAAAAFF+h6SjaM2Hec=", + "name": "Untitled", + "ownedElements": [ + { + "_type": "UMLModel", + "_id": "AAAAAAFF+qBWK6M3Z8Y=", + "_parent": { + "$ref": "AAAAAAFF+h6SjaM2Hec=" + }, + "name": "Model", + "ownedElements": [ + { + "_type": "UMLClassDiagram", + "_id": "AAAAAAFF+qBtyKM79qY=", + "_parent": { + "$ref": "AAAAAAFF+qBWK6M3Z8Y=" + }, + "name": "Main", + "defaultDiagram": true + } + ] + } + ] +} \ No newline at end of file diff --git a/2A/Java/tp/2_tp/TP2/.idea/.gitignore b/2A/Java/tp/2_tp/TP2/.idea/.gitignore new file mode 100644 index 0000000..26d3352 --- /dev/null +++ b/2A/Java/tp/2_tp/TP2/.idea/.gitignore @@ -0,0 +1,3 @@ +# Default ignored files +/shelf/ +/workspace.xml diff --git a/2A/Java/tp/2_tp/TP2/.idea/misc.xml b/2A/Java/tp/2_tp/TP2/.idea/misc.xml new file mode 100644 index 0000000..5295b2c --- /dev/null +++ b/2A/Java/tp/2_tp/TP2/.idea/misc.xml @@ -0,0 +1,6 @@ + + + + + + \ No newline at end of file diff --git a/2A/Java/tp/2_tp/TP2/.idea/modules.xml b/2A/Java/tp/2_tp/TP2/.idea/modules.xml new file mode 100644 index 0000000..8fa7630 --- /dev/null +++ b/2A/Java/tp/2_tp/TP2/.idea/modules.xml @@ -0,0 +1,8 @@ + + + + + + + + \ No newline at end of file diff --git a/2A/Java/tp/2_tp/TP2/.idea/vcs.xml b/2A/Java/tp/2_tp/TP2/.idea/vcs.xml new file mode 100644 index 0000000..bc59970 --- /dev/null +++ b/2A/Java/tp/2_tp/TP2/.idea/vcs.xml @@ -0,0 +1,6 @@ + + + + + + \ No newline at end of file diff --git a/2A/Java/tp/2_tp/TP2/TP2.iml b/2A/Java/tp/2_tp/TP2/TP2.iml new file mode 100644 index 0000000..c90834f --- /dev/null +++ b/2A/Java/tp/2_tp/TP2/TP2.iml @@ -0,0 +1,11 @@ + + + + + + + + + + + \ No newline at end of file diff --git a/2A/Java/tp/2_tp/TP2/out/production/TP2/models/Animal.class b/2A/Java/tp/2_tp/TP2/out/production/TP2/models/Animal.class new file mode 100644 index 0000000..dd5ec02 Binary files /dev/null and b/2A/Java/tp/2_tp/TP2/out/production/TP2/models/Animal.class differ diff --git a/2A/Java/tp/2_tp/TP2/out/production/TP2/models/AnimalFourrure.class b/2A/Java/tp/2_tp/TP2/out/production/TP2/models/AnimalFourrure.class new file mode 100644 index 0000000..03f9233 Binary files /dev/null and b/2A/Java/tp/2_tp/TP2/out/production/TP2/models/AnimalFourrure.class differ diff --git a/2A/Java/tp/2_tp/TP2/out/production/TP2/models/AnimalTheque.class b/2A/Java/tp/2_tp/TP2/out/production/TP2/models/AnimalTheque.class new file mode 100644 index 0000000..d755abe Binary files /dev/null and b/2A/Java/tp/2_tp/TP2/out/production/TP2/models/AnimalTheque.class differ diff --git a/2A/Java/tp/2_tp/TP2/out/production/TP2/models/Oiseau.class b/2A/Java/tp/2_tp/TP2/out/production/TP2/models/Oiseau.class new file mode 100644 index 0000000..3c947cd Binary files /dev/null and b/2A/Java/tp/2_tp/TP2/out/production/TP2/models/Oiseau.class differ diff --git a/2A/Java/tp/2_tp/TP2/out/production/TP2/utilitaires/Afficheur.class b/2A/Java/tp/2_tp/TP2/out/production/TP2/utilitaires/Afficheur.class new file mode 100644 index 0000000..88fd0a8 Binary files /dev/null and b/2A/Java/tp/2_tp/TP2/out/production/TP2/utilitaires/Afficheur.class differ diff --git a/2A/Java/tp/2_tp/TP2/out/production/TP2/utilitaires/Menu.class b/2A/Java/tp/2_tp/TP2/out/production/TP2/utilitaires/Menu.class new file mode 100644 index 0000000..5a6d132 Binary files /dev/null and b/2A/Java/tp/2_tp/TP2/out/production/TP2/utilitaires/Menu.class differ diff --git a/2A/Java/tp/2_tp/TP2/out/production/TP2/utilitaires/Saisisseur.class b/2A/Java/tp/2_tp/TP2/out/production/TP2/utilitaires/Saisisseur.class new file mode 100644 index 0000000..8661776 Binary files /dev/null and b/2A/Java/tp/2_tp/TP2/out/production/TP2/utilitaires/Saisisseur.class differ diff --git a/2A/Java/tp/2_tp/TP2/out/production/TP2/utilitaires/Suppresseur.class b/2A/Java/tp/2_tp/TP2/out/production/TP2/utilitaires/Suppresseur.class new file mode 100644 index 0000000..8e41266 Binary files /dev/null and b/2A/Java/tp/2_tp/TP2/out/production/TP2/utilitaires/Suppresseur.class differ diff --git a/2A/Java/tp/2_tp/TP2/src/main/Main.java b/2A/Java/tp/2_tp/TP2/src/main/Main.java new file mode 100644 index 0000000..6e8dccf --- /dev/null +++ b/2A/Java/tp/2_tp/TP2/src/main/Main.java @@ -0,0 +1,26 @@ +package main; + +import models.Animal; +import models.AnimalFourrure; +import models.AnimalTheque; +import models.Oiseau; +import utilitaires.Afficheur; + +public class Main { + public static void testOiseau(){ + Animal oiseau = new Oiseau("sozio", 1); + System.out.println(oiseau.getNom()); + System.out.println(oiseau.getZone()); + System.out.println(oiseau.getClass()); + } + public static void testAnimalFourrure(){ + Animal af = new AnimalFourrure("ours", 1, 0); + System.out.println(af.getNom()); + System.out.println(af.getZone()); + System.out.println(af.getClass()); + } + + public static void main(String[] args){ + testAnimalFourrure(); + } +} diff --git a/2A/Java/tp/2_tp/TP2/src/models/Animal.java b/2A/Java/tp/2_tp/TP2/src/models/Animal.java new file mode 100644 index 0000000..55174d7 --- /dev/null +++ b/2A/Java/tp/2_tp/TP2/src/models/Animal.java @@ -0,0 +1,26 @@ +package models; + +import com.sun.management.UnixOperatingSystemMXBean; + +public abstract class Animal { + protected String nom; + protected int zone; + protected Animal(String nomAnimal, int zoneAnimal){ + this.nom = nomAnimal; + this.zone = zoneAnimal; + } + + public int getZone() { + return zone; + } + + public String getNom() { + return nom; + } + + protected void setZone(int zone) { + this.zone = zone; + } + + protected abstract void hiverner(); +} diff --git a/2A/Java/tp/2_tp/TP2/src/models/AnimalFourrure.java b/2A/Java/tp/2_tp/TP2/src/models/AnimalFourrure.java new file mode 100644 index 0000000..94be8a1 --- /dev/null +++ b/2A/Java/tp/2_tp/TP2/src/models/AnimalFourrure.java @@ -0,0 +1,23 @@ +package models; + +public class AnimalFourrure extends Animal { + private int densiteFourrure; + + public AnimalFourrure(String nomAnimal, int zoneAnimal, int densite) { + super(nomAnimal, zoneAnimal); + this.densiteFourrure = densite; + } + + public void setFourrure(int densite){ + this.densiteFourrure = densite; + } + + public void hiverner() { + if(this.densiteFourrure == 1){ + setFourrure(0); + } + else { + setFourrure(1); + } + } +} diff --git a/2A/Java/tp/2_tp/TP2/src/models/AnimalTheque.java b/2A/Java/tp/2_tp/TP2/src/models/AnimalTheque.java new file mode 100644 index 0000000..8ec0225 --- /dev/null +++ b/2A/Java/tp/2_tp/TP2/src/models/AnimalTheque.java @@ -0,0 +1,9 @@ +package models; + +import java.util.ArrayList; +import java.util.List; + +public class AnimalTheque { + public List lesAnimaux = new ArrayList<>(); + +} diff --git a/2A/Java/tp/2_tp/TP2/src/models/Oiseau.java b/2A/Java/tp/2_tp/TP2/src/models/Oiseau.java new file mode 100644 index 0000000..21ddaab --- /dev/null +++ b/2A/Java/tp/2_tp/TP2/src/models/Oiseau.java @@ -0,0 +1,17 @@ +package models; + +public class Oiseau extends Animal{ + + public Oiseau(String nomAnimal, int zoneAnimal){ + super(nomAnimal, zoneAnimal); + } + + public void hiverner() { + if(this.zone == 0) { + super.setZone(1); + } + else { + super.setZone(0); + } + } +} diff --git a/2A/Java/tp/2_tp/TP2/src/utilitaires/Afficheur.java b/2A/Java/tp/2_tp/TP2/src/utilitaires/Afficheur.java new file mode 100644 index 0000000..912eca9 --- /dev/null +++ b/2A/Java/tp/2_tp/TP2/src/utilitaires/Afficheur.java @@ -0,0 +1,4 @@ +package utilitaires; + +public class Afficheur { +} diff --git a/2A/Java/tp/2_tp/TP2/src/utilitaires/Menu.java b/2A/Java/tp/2_tp/TP2/src/utilitaires/Menu.java new file mode 100644 index 0000000..f306a3d --- /dev/null +++ b/2A/Java/tp/2_tp/TP2/src/utilitaires/Menu.java @@ -0,0 +1,4 @@ +package utilitaires; + +public class Menu { +} diff --git a/2A/Java/tp/2_tp/TP2/src/utilitaires/Saisisseur.java b/2A/Java/tp/2_tp/TP2/src/utilitaires/Saisisseur.java new file mode 100644 index 0000000..a415c05 --- /dev/null +++ b/2A/Java/tp/2_tp/TP2/src/utilitaires/Saisisseur.java @@ -0,0 +1,4 @@ +package utilitaires; + +public class Saisisseur { +} diff --git a/2A/Java/tp/2_tp/TP2/src/utilitaires/Suppresseur.java b/2A/Java/tp/2_tp/TP2/src/utilitaires/Suppresseur.java new file mode 100644 index 0000000..ccccdde --- /dev/null +++ b/2A/Java/tp/2_tp/TP2/src/utilitaires/Suppresseur.java @@ -0,0 +1,4 @@ +package utilitaires; + +public class Suppresseur { +}