Random birth Cheng Si is calculated 2

Source: Internet
Author: User

 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

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.