class Drikke implements DrikkBar { protected double max; protected double innhold; public Drikke(double max) { this.max = max; innhold = max; } public void fyllOpp() { innhold = max; } public void drikkGlass() { if (innhold < 2) { innhold = 0; } else { innhold -= 2; } } @Override public String toString() { return "Det er " + innhold + " igjen, \nog det er plass til " + max + " dl"; }