Slide 9
Slide 9 text
jgs
Javier Gonzalez-Sanchez | CSC 308 | Winter 2023 | 9
import java.util.Observable;
public class Tutor extends Observable {
private String [] questions = { "2 + 2",
"public or private",
"functional or not fuctional",
"white or black"
};
private String theQuestion;
public void askQuestion() {
theQuestion = questions[((int)(Math.random()*10))%4];
setChanged();
notifyObservers();
}
public String getQuestion() {
return theQuestion;
}
}
Tutor