public class Kaffedrikker implements Runnable { Bord bord; Barista barista; public Kaffedrikker(Bord b, Barista ba) { bord = b; barista = ba; } public void run() { int antDrukket = 0; try { Barista hentetKaffe = bord.hentKaffe(); //System.out.println("kaffedrikker - run()"); while(hentetKaffe != null){ antDrukket++; //System.out.println("kaffedrikker id: " + hentetKaffe.hentId() + ", type kaffe: " + hentetKaffe.hentKaffe()); hentetKaffe = bord.hentKaffe(); //henter ny kaffe } //System.out.println("\nikke flere kaffer igjen"); System.out.println("barista id: " + barista.hentId() + ", ant kaffe drukket: " + antDrukket); //while ikkeTomt --> print id og kaffe drukket //if ikke flere kaffer aa drikke --> print id og antDrukket } catch (InterruptedException e) { // TODO Auto-generated catch block e.printStackTrace(); } } }