compartiment fonction servir(), remplir() et getQuatite()
This commit is contained in:
@@ -1,3 +1,21 @@
|
|||||||
public class Compartiment {
|
public class Compartiment{
|
||||||
|
protected final int QUANTITE_MAX = 1000;
|
||||||
|
private int quantite_courant = 0;
|
||||||
|
|
||||||
|
synchronized void remplir(){
|
||||||
|
quantite_courant = QUANTITE_MAX;
|
||||||
|
}
|
||||||
|
|
||||||
|
synchronized void servir(int qte){
|
||||||
|
if(qte>quantite_courant){
|
||||||
|
|
||||||
|
}
|
||||||
|
else{
|
||||||
|
quantite_courant -= qte;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public int getQuantite(){
|
||||||
|
return quantite_courant;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,3 +1,4 @@
|
|||||||
public class Restaurant {
|
public class Restaurant {
|
||||||
protected final int MAX_CLIENTS = 25;
|
protected final int MAX_CLIENTS = 25;
|
||||||
|
private int nbClient = 0;
|
||||||
}
|
}
|
||||||
Reference in New Issue
Block a user