Skip to content
Snippets Groups Projects
Commit 29cee14d authored by Baptiste Royer's avatar Baptiste Royer
Browse files

Ajout des dossiers et fichiers importants

parent dc025454
Branches
No related tags found
No related merge requests found
package td07;
public interface Animaux {
public String shout();
public int foodAmount();
public boolean isPet();
}
\ No newline at end of file
package td07;
public class Banc {
}
\ No newline at end of file
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
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
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
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment