diff --git a/src/td07/Animaux.java b/src/td07/Animaux.java new file mode 100644 index 0000000000000000000000000000000000000000..f3d98f0563021fffb4c4facb199df27a51dc452d --- /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 0000000000000000000000000000000000000000..ad8c5d79ad430443643e8dcb5322f2c999a8bd72 --- /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 0000000000000000000000000000000000000000..485836963780201668c308d8cb0b184a4b278283 --- /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 0000000000000000000000000000000000000000..e351f7dc2b36f4ca56af356955233fa5631ebf2e --- /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 0000000000000000000000000000000000000000..bda0be11b06162540f1ab09b1d5a905f74602a4d --- /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