From 29cee14d4670318a2767a832ffc92081e2aab0ee Mon Sep 17 00:00:00 2001 From: Baptiste Royer <baptiste.royer.etu@univ-lille.fr> Date: Fri, 12 Apr 2024 15:04:12 +0200 Subject: [PATCH] Ajout des dossiers et fichiers importants --- src/td07/Animaux.java | 7 +++++++ src/td07/Banc.java | 5 +++++ src/td07/Fish.java | 34 +++++++++++++++++++++++++++++++++ src/td07/Pig.java | 44 +++++++++++++++++++++++++++++++++++++++++++ src/td07/Tigre.java | 32 +++++++++++++++++++++++++++++++ 5 files changed, 122 insertions(+) create mode 100644 src/td07/Animaux.java create mode 100644 src/td07/Banc.java create mode 100644 src/td07/Fish.java create mode 100644 src/td07/Pig.java create mode 100644 src/td07/Tigre.java diff --git a/src/td07/Animaux.java b/src/td07/Animaux.java new file mode 100644 index 0000000..f3d98f0 --- /dev/null +++ b/src/td07/Animaux.java @@ -0,0 +1,7 @@ +package td07; + +public interface Animaux { + public String shout(); + public int foodAmount(); + public boolean isPet(); +} \ No newline at end of file diff --git a/src/td07/Banc.java b/src/td07/Banc.java new file mode 100644 index 0000000..ad8c5d7 --- /dev/null +++ b/src/td07/Banc.java @@ -0,0 +1,5 @@ +package td07; + +public class Banc { + +} \ No newline at end of file diff --git a/src/td07/Fish.java b/src/td07/Fish.java new file mode 100644 index 0000000..4858369 --- /dev/null +++ b/src/td07/Fish.java @@ -0,0 +1,34 @@ +package td07; + +public class Fish implements Animaux{ + private static final int FOOD = 1; //En UML, un final doit être écrit en majuscules. + private String name; + + public Fish(String name) { //+Fish(String) + this.name = name; + } + + public String shout() { //+shout() : String + return "Blob!"; + } + + public int foodAmount() { + return this.FOOD; //+foodAmount() : int + } + + public boolean isPet() { //+isPet() : boolean + return true; + } + + public String toString() { //+toString() : String + return ""; + } + + public int getFOOD() { //+getFOOD() : int + return this.mealSize; + } + + public int getName() { //+getName() : String + return this.weight; + } +} \ No newline at end of file diff --git a/src/td07/Pig.java b/src/td07/Pig.java new file mode 100644 index 0000000..e351f7d --- /dev/null +++ b/src/td07/Pig.java @@ -0,0 +1,44 @@ +package td07; + +public class Pig implements Animaux{ + private static int mealSize; //En UML, static doit être souligné. + private int weight; + private String name; + + public Pig(String name, int weight) { //+Pig(String, int) + this.name = name; + this.weight = weight; + } + + public String shout() { //shout() : String + return "Grouik!"; + } + + public int foodAmount() { //foodAmount() : int + return this.mealSize; + } + + public boolean isPet() { //isPet() : boolean + return true; + } + + public void rollingInMud() { //rollingInMud() : void + println("Rolls in the mud."); + } + + public String toString() { //toString() : String + return ""; + } + + public int getMealSize() { //getMealSize() : int + return this.mealSize; + } + + public int getWeight() { //getWeight() : int + return this.weight; + } + + public String getName() { //getName() : String + return this.name; + } +} \ No newline at end of file diff --git a/src/td07/Tigre.java b/src/td07/Tigre.java new file mode 100644 index 0000000..bda0be1 --- /dev/null +++ b/src/td07/Tigre.java @@ -0,0 +1,32 @@ +package td07; + +public class Tigre implements Animaux{ + private static final int MIN_FOOD = 0; //En UML, un final doit être écrit en majuscules. + private static final int MAX_FOOD = 20; + + public Tiger() { //+Tigre() + } + + public String shout() { //+shout() : String + return "Purr!"; + } + + public int foodAmount() { //+foodAmount() : int + } + + public boolean isPet() { //+isPet() : boolean + return true; + } + + public String toString() { //+toString() : String + return ""; + } + + public int getMIN_FOOD() { //+getMIN_FOOD() : int + return this.mealSize; + } + + public int getWeight() { //+getMAX_FOOD() : int + return this.weight; + } +} \ No newline at end of file -- GitLab