import java.util.ArrayList; class Quiz { ArrayList liste; int antallBesvarteSpoersmaal; int antallRiktigeSvar; int antallFeilSvar; public Quiz(){ liste = new ArrayList(); antallBesvarteSpoersmaal = 0; antallRiktigeSvar = 0; antallFeilSvar = 0; } public void oekRiktigSvar(){ antallRiktigeSvar++; antallBesvarteSpoersmaal++; } public void oekFeilSvar(){ antallFeilSvar++; antallBesvarteSpoersmaal++; } public void leggTilSpoersmaal(String spm, int svar){ Spoersmaal nyttSpm = new Spoersmaal(spm, svar, this); liste.add(nyttSpm); } public void kjoerQuiz(){ System.out.println("Velkommen til QUIZ!"); while (antallBesvarteSpoersmaal < liste.size()){ System.out.print("Sp?rsm?l " + (antallBesvarteSpoersmaal+1) + ": " ); liste.get(antallBesvarteSpoersmaal).kjoerSpoersmaal(); System.out.println(); } System.out.println("FLOTTE GREIER. Du klarte " + antallRiktigeSvar + " av " + antallBesvarteSpoersmaal + " sp?rsm?l!"); } }