Packagefee;ImportJava.util.*;ImportJava.util.Random; Public classpp {StaticScanner in =NewScanner (system.in); StaticRandom r =NewRandom (); Public Static voidMain (string[] args) {System.out.println ("I got 5 points for the right answer."); System.out.println ("Number of input questions:"); intx =In.nextint (); intFenshu=0; //int R1=r.nextint (100); //int R2=r.nextint (+);SYSTEM.OUT.PRINTLN ("Input 1 means addition 2 means minus 3 means multiply by 4 means except:"); inty =In.nextint (); Switch(y) { Case1: for(inti = 0; i < x; i++) { DoubleR1 = r.nextint (100); Doubler2 = r.nextint (100); System.out.println (R1+ "+" + r2 + "="); DoubleA =In.nextint (); Doubleb = r1+R2; if(a==b) {System.out.println ("correct it! Get 5 points "); fenshu=fenshu+5;} Else{System.out.println ("wrong hit, correct answer for" +b);} System.out.println ("Your current score is" +Fenshu); } Break; Case2: for(inti = 0; i < x; i++) { DoubleR1 = r.nextint (100); Doubler2 = r.nextint (100); System.out.println (R1+ "-" + r2 + "="); DoubleA =In.nextint (); Doubleb = r1-R2; if(a==b) {System.out.println ("correct it! Get 5 points "); fenshu=fenshu+5;} Else{System.out.println ("wrong hit, correct answer for" +b);} System.out.println ("Your current score is" +Fenshu); } Break; Case3: for(inti = 0; i < x; i++) { DoubleR1 = r.nextint (100); Doubler2 = r.nextint (100); System.out.println (R1+ "*" + r2 + "="); DoubleA =In.nextint (); Doubleb = r1*R2; if(a==b) {System.out.println ("correct it! Get 5 points "); fenshu=fenshu+5;} Else{System.out.println ("wrong hit, correct answer for" +b);} System.out.println ("Your current score is" +Fenshu); } Break; Case4: for(inti = 0; i < x; i++) { DoubleR1 = r.nextint (100); Doubler2 = r.nextint (100); System.out.println (R1+ "/" + r2 + "="); DoubleA =In.nextint (); Doubleb = r1/R2; if(a==b) {System.out.println ("correct it! Get 5 points "); fenshu=fenshu+5;} Else{System.out.println ("wrong hit, correct answer for" +b);} System.out.println ("Your current score is" +Fenshu); } Break; } System.out.println ("You get the score for" +Fenshu); }}
True Fractional function not implemented
Random birth Cheng Si is calculated 2