This commit is contained in:
Simon SAYE BABU 2023-12-15 10:35:50 +01:00
parent b825103d79
commit f9fa89a97f
4 changed files with 18 additions and 5 deletions

View File

@ -28,14 +28,19 @@ public class Billet {
{
case Un:
output = 1;
break;
case Cinq:
output = 5;
break;
case Dix:
output = 10;
break;
/*case Vingt:
output = 20;*/
output = 20;
break;*/
default:
output = 0;
break;
}
return output;
}

View File

@ -3,8 +3,13 @@
* (Un billet peut avoir les valeurs suivantes Un, Cinq, Dix, Vingt)
*/
public enum Denomination {
Un,
Cinq,
Dix;
Un (1),
Cinq(5),
Dix(10);
//Vingt;
private int valeur;
private Denomination(int v)
{
this.valeur = v;
}
}

View File

@ -38,7 +38,7 @@ public class Individu {
*/
public int getInt(){
int somme = 0;
for (Billet billet : monnaie) {
for (Billet billet : this.monnaie) {
somme += billet.getInt();
}
return somme;

View File

@ -18,6 +18,9 @@ public class Main {
Toto.addMonaie(new Billet(Denomination.Un));
Toto.addMonaie(new Billet(Denomination.Un));
System.out.println(Titi.getInt());
System.out.println(Toto.getInt());