1 Design Ideas
Define variables:
int i,b,num1,num2,num3;
Double m,n;
Practical loop Implementation 30 times:
Random generation of the number of participating operations and operators;
Using switch to achieve arithmetic and output;
Source:
Package random;
public class Suiji {
public static void Main (string[] args) {
int i,b,num1,num2,num3;
Double m,n;
for (i=0;i<30;i++)
{
b= (int) (Math.random ());
if (b==1) {
M= (Double) (Math.random () *99+1);
N= (Double) (Math.random () *99+1);
num3= (int) (Math.random ());
Switch (num3) {
Case 0:system.out.println (m+ "+" +n+ "=");
Case 1:system.out.println (m+ "-" +n+ "=");
Case 2:SYSTEM.OUT.PRINTLN (m+ "*" +n+ "=");
Case 3:system.out.println (m+ "/" +n+ "=");
}
}
Else
{
num1= (int) (Math.random () *100);
num2= (int) (Math.random () *100);
num3= (int) (Math.random ());
Switch (num3) {
Case 0:system.out.println (num1+ "+" +num2+ "=");
Case 1:system.out.println (num1+ "-" +num2+ "=");
Case 2:SYSTEM.OUT.PRINTLN (num1+ "*" +num2+ "=");
Case 3:system.out.println (num1+ "/" +num2+ "=");
}
}
}
}
}
Operation Result:
Software Engineering Operations 1