我如何为此设置一个极限问题
public void setQuestion() {
Random rand = new Random();
int value1 = rand.nextInt(100-10) + 10;
int value2 = rand.nextInt(20-2) + 2;
int randomquestion = rand.nextInt(4);
if (randomquestion == 1) {
question.setText("What is " + value1 + "+" + value2 + " ? ");
expected = "" + (value1 + value2);
} else if (randomquestion == 2) {
question.setText("What is " + value1 + "-" + value2 + " ? ");
expected = "" + (value1 - value2);
} else if (randomquestion == 3) {
question.setText("What is " + value1 + "x" + value2 + " ? ");
expected = "" + (value1 * value2);
} else {
question.setText("What is " + value1 + "÷" + value2 + "?");
expected = "" + (value1 / value2);
}
}
我希望它只能提出10个问题,并会结束活动