This commit is contained in:
2023-04-04 14:03:16 +02:00
parent 7021891e9c
commit e32d4de827
111 changed files with 1928 additions and 6 deletions

View File

@@ -0,0 +1,36 @@
//MELIANI SAMY (TP1)
public class Deduction{
public static void main(String[] args) {
Deduction2 compte = new Deduction2();
compte.voir();
compte.crediter();
compte.crediter();
compte.crediter();
compte.crediter();
compte.crediter();
compte.vider();
compte.crediter();
compte.crediter();
compte.crediter();
compte.crediter();
compte.crediter();
compte.crediter();
compte.crediter();
compte.crediter();
compte.crediter();
compte.crediter();
System.out.println(compte.toString());
Deduction3 compte2 = new Deduction3();
compte2.crediter();
compte2.crediter();
compte2.crediter();
compte2.crediter();
compte2.crediter();
compte2.crediter();
compte2.crediter();
compte2.crediter();
compte2.crediter();
System.out.println(compte2.toString());
}
}

View File

@@ -0,0 +1,39 @@
//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;
}
}

View File

@@ -0,0 +1,30 @@
//MELIANI SAMY (TP1)
public class Deduction3{
private int Limite, identifiant, Credit;
private int Accumulation;
public Deduction3(){
Limite = 10;
Accumulation=0;
Credit = 10;
identifiant = 253782;
}
public int voir(){
return Credit;
}
public void crediter(){
Accumulation += 1;
}
public void vider(){
Credit = 10;
}
public String toString(){
String str = "";
str += "YesCard USER ";
str += "identifiant : " + identifiant + " ";
str += "Crédits restants : " + Credit + " ";
str += "Accumulation : " + Accumulation;
str+= " PLAT OFFERT ";
return str;
}
}