1. Program Design Ideas
Referring to the Random class, first set 3 random numbers, 1 of which are operator random, and the other two are 0 to About integer random number that is the arithmetic of the integer. Then set 3 random numbers, one of which is the operator random number and the other two are integer random numbers from 0 to The first two random integers and the last two random integers each make up a true fraction, arithmetic the true fraction. A maximum outer cycle, the number of cycles of five times, to obtain the problem.
2. SOURCE program code
1 PackageKetang;2 3 ImportJava.util.Random;4 5 Public classSizeyunsuan {6 7 Public Static voidMain (string[] args) {8 intA1,a2,a;9Random ran=NewRandom ();Ten for(inti=0;i<30;i++) One { AA=ran.nextint (5); -A1=ran.nextint (100); -A2=ran.nextint (100); the if(a==0) -System.out.println (a1+ "+" +a2+ "="); - if(a==1) - { +System.out.println (a1+ "-" +a2+ "="); - } + if(a==2) ASYSTEM.OUT.PRINTLN (a1+ "*" +a2+ "="); at if(a==3) - { - while(a2==0) -A2=ran.nextint (100); -System.out.println (a1+ "/" +a2+ "="); - } in if(a==4) - { to intaa,a3,a4; +Aa=ran.nextint (4); -A3=ran.nextint (100); theA4=ran.nextint (100); * if(aa==0) $ {Panax Notoginseng if(a1<a2&&a3<A4) -System.out.println (a1+ "/" +a2+ "+" +a3+ "/" +a4+ "="); the if(a1>a2&&a3>A4) +System.out.println (a2+ "/" +a1+ "+" +a4+ "/" +a3+ "="); A if(a1>a2&&a3<A4) theSystem.out.println (a2+ "/" +a1+ "+" +a3+ "/" +a4+ "="); + if(a1<a2&&a3>A4) -System.out.println (a1+ "/" +a2+ "+" +a4+ "/" +a3+ "="); $ if(a1<a2&&a3==A4) $System.out.println (a1+ "/" +a2+ "+" +a3+ "/" + (a4+1) + "="); - if(a1>a2&&a3==A4) -System.out.println (a2+ "/" +a1+ "+" +a3+ "/" + (a4+1) + "="); the if(a1==a2&&a3<A4) -System.out.println (a1+ "/" + (a2+1) + "+" +a3+ "/" +a4+ "=");Wuyi if(a1==a2&&a3>A4) theSystem.out.println (a1+ "/" + (a2+1) + "+" +a4+ "/" +a3+ "="); - if(a1==a2&&a3==A4) WuSystem.out.println (a1+ "/" + (a2+1) + "+" +a4+ "/" + (a3+1) + "="); - } About if(aa==1) $ { - if(a1<a2&&a3<A4) -System.out.println (a1+ "/" +a2+ "-" +a3+ "/" +a4+ "="); - if(a1>a2&&a3>A4) ASystem.out.println (a2+ "/" +a1+ "-" +a4+ "/" +a3+ "="); + if(a1>a2&&a3<A4) theSystem.out.println (a2+ "/" +a1+ "-" +a3+ "/" +a4+ "="); - if(a1<a2&&a3>A4) $System.out.println (a1+ "/" +a2+ "-" +a4+ "/" +a3+ "="); the if(a1<a2&&a3==A4) theSystem.out.println (a1+ "/" +a2+ "-" +a3+ "/" + (a4+1) + "="); the if(a1>a2&&a3==A4) theSystem.out.println (a2+ "/" +a1+ "-" +a3+ "/" + (a4+1) + "="); - if(a1==a2&&a3<A4) inSystem.out.println (a1+ "/" + (a2+1) + "-" +a3+ "/" +a4+ "="); the if(a1==a2&&a3>A4) theSystem.out.println (a1+ "/" + (a2+1) + "-" +a4+ "/" +a3+ "="); About if(a1==a2&&a3==A4) theSystem.out.println (a1+ "/" + (a2+1) + "-" +a4+ "/" + (a3+1) + "="); the } the if(aa==2) + { - if(a1<a2&&a3<A4) theSystem.out.println (a1+ "/" +a2+ "*" +a3+ "/" +a4+ "=");Bayi if(a1>a2&&a3>A4) theSystem.out.println (a2+ "/" +a1+ "*" +a4+ "/" +a3+ "="); the if(a1>a2&&a3<A4) -System.out.println (a2+ "/" +a1+ "*" +a3+ "/" +a4+ "="); - if(a1<a2&&a3>A4) theSystem.out.println (a1+ "/" +a2+ "*" +a4+ "/" +a3+ "="); the if(a1<a2&&a3==A4) theSystem.out.println (a1+ "/" +a2+ "*" +a3+ "/" + (a4+1) + "="); the if(a1>a2&&a3==A4) -System.out.println (a2+ "/" +a1+ "*" +a3+ "/" + (a4+1) + "="); the if(a1==a2&&a3<A4) theSystem.out.println (a1+ "/" + (A2+1) + "*" +a3+ "/" +a4+ "="); the if(a1==a2&&a3>A4)94System.out.println (a1+ "/" + (A2+1) + "*" +a4+ "/" +a3+ "="); the if(a1==a2&&a3==A4) theSystem.out.println (a1+ "/" + (A2+1) + "*" +a4+ "/" + (a3+1) + "="); the }98 if(aa==3) About { - if(a1<a2&&a3<A4)101System.out.println (a1+ "/" +a2+ "/" +a3+ "/" +a4+ "=");102 if(a1>a2&&a3>A4)103System.out.println (a2+ "/" +a1+ "/" +a4+ "/" +a3+ "=");104 if(a1>a2&&a3<A4) theSystem.out.println (a2+ "/" +a1+ "/" +a3+ "/" +a4+ "=");106 if(a1<a2&&a3>A4)107System.out.println (a1+ "/" +a2+ "/" +a4+ "/" +a3+ "=");108 if(a1<a2&&a3==A4)109System.out.println (a1+ "/" +a2+ "/" +a3+ "/" + (a4+1) + "="); the if(a1>a2&&a3==A4)111System.out.println (a2+ "/" +a1+ "/" +a3+ "/" + (a4+1) + "="); the if(a1==a2&&a3<A4)113System.out.println (a1+ "/" + (a2+1) + "/" +a3+ "/" +a4+ "="); the if(a1==a2&&a3>A4) theSystem.out.println (a1+ "/" + (a2+1) + "/" +a4+ "/" +a3+ "="); the if(a1==a2&&a3==A4)117System.out.println (a1+ "/" + (a2+1) + "/" +a4+ "/" + (a3+1) + "=");118 }119 - }121 }122 }123 124}
View Code
3. Running Results
4. Reasons for incomplete analysis in class
In class think less, think of not thoughtful.
Software Engineering Personal Assignment 01