You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
MathLearningApp/src/main/java/mathlearning/service/QuestionGenerator/middleGenerator.java

23 lines
602 B

package mathlearning.service.QuestionGenerator;
public class middleGenerator extends QuestionGenerator{
public middleGenerator() {
super("初中");
}
@Override
public String generateQuestion() {
int operandCount = random.nextInt(4) + 2;
// 生成操作数
int[] operands = new int [ operandCount ];
for (int i = 0; i < operandCount; i++) {
operands[i] = random.nextInt(100) + 1; // 1-100
}
String question = preForOper(operands);
question = add_squs(question);
return addParen(question);
}
}