maj print

This commit is contained in:
trochas
2024-12-03 16:11:50 +01:00
parent 5957c5e842
commit 78c388ca9d
3 changed files with 12 additions and 5 deletions

View File

@@ -31,7 +31,7 @@ public class Client extends Thread {
} catch (InterruptedException e){ } catch (InterruptedException e){
e.printStackTrace(); e.printStackTrace();
} }
System.out.println("Clien " + Thread.currentThread().getId() + " : a pris une portion"); System.out.println("Clien " + Thread.currentThread().getId() + " : a pris une portion de " + compartiment.getName());
compartiment.servir(r); compartiment.servir(r);
try{ try{

View File

@@ -3,8 +3,9 @@ public class Compartiment{
private int quantite_courant; private int quantite_courant;
private String name; private String name;
Compartiment(){ Compartiment(String name){
quantite_courant = 500; quantite_courant = 500;
this.name = name;
} }
synchronized void remplir(){ synchronized void remplir(){
@@ -18,4 +19,8 @@ public class Compartiment{
public int getQuantite(){ public int getQuantite(){
return quantite_courant; return quantite_courant;
} }
public String getName(){
return this.name;
}
} }

View File

@@ -30,9 +30,11 @@ public class Restaurant {
*/ */
public Restaurant(){ public Restaurant(){
this.nbClient=0; this.nbClient=0;
for(int i = 0 ; i<buffet.length; i++){ this.buffet[0] = new Compartiment("posson");
this.buffet[i] = new Compartiment(); this.buffet[1] = new Compartiment("viande");
} this.buffet[2] = new Compartiment("légume");
this.buffet[3] = new Compartiment("nouille");
this.employeB = new Employe_du_buffet(buffet); this.employeB = new Employe_du_buffet(buffet);
this.stand_de_cuisson = new Stand_de_cuisson(); this.stand_de_cuisson = new Stand_de_cuisson();
this.cuisinier = new Cuisinier(stand_de_cuisson); this.cuisinier = new Cuisinier(stand_de_cuisson);