39 lines
700 B
Java
39 lines
700 B
Java
//MELIANI SAMY (TP1)
|
|
public class Deduction2{
|
|
private int Limite, identifiant, Credit;
|
|
private int Accumulation;
|
|
public Deduction2(){
|
|
Limite = 10;
|
|
Accumulation=0;
|
|
Credit = 0;
|
|
identifiant = 253782;
|
|
}
|
|
public int voir(){
|
|
return Credit;
|
|
}
|
|
public void crediter(){
|
|
if (Credit < 10){
|
|
Credit += 1;
|
|
Accumulation += 1;
|
|
}
|
|
else{
|
|
Credit = 1;
|
|
Accumulation += 1;
|
|
}
|
|
}
|
|
public void vider(){
|
|
Credit = 0;
|
|
}
|
|
public String toString(){
|
|
String str = "";
|
|
str += "identifiant : " + identifiant + " ";
|
|
str += "Crédits restants : " + Credit + " ";
|
|
str += "Accumulation : " + Accumulation;
|
|
if(Credit == 10){
|
|
str+= " PLAT OFFERT ";
|
|
}
|
|
return str;
|
|
|
|
}
|
|
|
|
} |