66 lines
1.4 KiB
Java
66 lines
1.4 KiB
Java
|
public class Monoliasse{
|
||
|
private Denomination valeur;
|
||
|
private int combien;
|
||
|
|
||
|
public Monoliasse(){
|
||
|
this.valeur = null;
|
||
|
this.combien = 0;
|
||
|
}
|
||
|
|
||
|
public Monoliasse(Denomination valeur){
|
||
|
this.valeur = valeur;
|
||
|
this.combien = 1;
|
||
|
}
|
||
|
|
||
|
public Monoliasse(Denomination valeur, int combien){
|
||
|
this.valeur = valeur;
|
||
|
this.combien = combien;
|
||
|
}
|
||
|
|
||
|
public void addBillet(){
|
||
|
this.combien ++;
|
||
|
}
|
||
|
|
||
|
public void removeBillet(){
|
||
|
this.combien --;
|
||
|
}
|
||
|
|
||
|
public int getCombien(){
|
||
|
return this.combien;
|
||
|
}
|
||
|
|
||
|
public int getValeurMonoliasse(){
|
||
|
return this.getValeurBillet()*this.combien;
|
||
|
}
|
||
|
|
||
|
public int getValeurBillet(){
|
||
|
if (valeur == Denomination.UN){
|
||
|
return 1;
|
||
|
}
|
||
|
if (valeur == Denomination.DEUX){
|
||
|
return 2;
|
||
|
}
|
||
|
if (valeur == Denomination.CINQ){
|
||
|
return 5;
|
||
|
}
|
||
|
if (valeur == Denomination.DIX){
|
||
|
return 10;
|
||
|
}
|
||
|
if (valeur == Denomination.VINGT){
|
||
|
return 20;
|
||
|
}
|
||
|
if (valeur == Denomination.CINQUANTE){
|
||
|
return 50;
|
||
|
}
|
||
|
if (valeur == Denomination.CENT){
|
||
|
return 100;
|
||
|
}
|
||
|
if (valeur == Denomination.DEUX_CENT){
|
||
|
return 200;
|
||
|
}
|
||
|
if (valeur == Denomination.CINQ_CENT){
|
||
|
return 500;
|
||
|
}
|
||
|
return 0;
|
||
|
}
|
||
|
}
|