import java.util.Random; public class Barista implements Runnable { private final String[] drikker = {"Americano", "Cafe au lait", "Caffe latte", "Caffe mocca", "Espresso", "Cortado"}; Bord bord; int id, antBaristaer; String kaffe = null; public Barista(Bord b, int i, int ant){ bord = b; id = i; antBaristaer = ant; } public void run(){ Random random = new Random(); int randomnr = random.nextInt((drikker.length)); int teller = 0; while(teller < 10){ kaffe = drikker[randomnr]; //System.out.println("Barista run() - teller 1: " + teller); bord.serverKaffe(this, false); //System.out.println("teller 2: " + teller); teller++; } bord.serverKaffe(this, true); //System.out.println("teller == 10: " + teller); //System.out.println("signaliserer - barista"); bord.signaliser(); //signaliserer at en traad er ferdig } public int hentId(){ return id; } public String hentKaffe(){ return kaffe; } }