package mathlearning.service.QuestionGenerator; public class PrimaryGenerator extends QuestionGenerator{ public PrimaryGenerator() { 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); return addParen(question); } }