maj client

This commit is contained in:
trochas
2024-12-02 16:30:52 +01:00
parent 2e59ca9239
commit aedd491b7b
2 changed files with 13 additions and 10 deletions

View File

@@ -10,13 +10,15 @@ public class Client extends Thread {
public void run(){ public void run(){
while(!this.restaurant.libre()){
try { entrer();
wait(); for(int i = 0; i<this.restaurant.buffet.length; i++){
} catch (Exception e) { prendre_portion(this.restaurant.buffet[i]);
System.out.println("Mi piace tagliare gli spaghetti ! Mi piace la pizza all'ananas ! \n" + e);
}
} }
cuir_au_stand(restaurant.stand_de_cuisson);
manger();
sort();
} }
public void prendre_portion(Compartiment compartiment){ public void prendre_portion(Compartiment compartiment){

View File

@@ -2,9 +2,9 @@ public class Restaurant {
protected final int MAX_CLIENTS = 25; protected final int MAX_CLIENTS = 25;
private int nbClient; private int nbClient;
private Compartiment[] buffet = new Compartiment[4]; public Compartiment[] buffet = new Compartiment[4];
private Employe_du_buffet employeB; private Employe_du_buffet employeB;
private Stand_de_cuisson stand_de_cuisson; public Stand_de_cuisson stand_de_cuisson;
private Cuisinier cuisinier; private Cuisinier cuisinier;
Restaurant(){ Restaurant(){
@@ -35,8 +35,9 @@ public class Restaurant {
} }
public synchronized void diminuerClient(){ public synchronized void diminuerClient(){
if(nbClient<MAX_CLIENTS){ if(nbClient>MAX_CLIENTS){
nbClient++; nbClient--;
} }
} }
} }