9.11
学到了编程的精义,编程思维:分解、模式识别、抽象、算法、单元测试、整合
回顾了random的使用
import java.util.Random;
public class Number {
public static void main(String[] args) {
Random random = new Random();
for (int i = 0; i < 30; i++) {
int n1 = random.nextInt(90) + 10;
int n2 = random.nextInt(90) + 10;
String[] operators = {"+", "-", "*", "/"};
String operator = operators[random.nextInt(4)];
String arithmeticExpression = n1 + " " + operator + " " + n2 + " = ";
System.out.println(arithmeticExpression);
}
}
}