First iteration Job

Source: Internet
Author: User

1 ImportJava.util.Scanner;2 Importjava.util.Arrays;3 4 5 6  Public classMian {7 8     /**9      * @paramargsTen      */ One      Public Static voidMain (string[] args) { A         //TODO auto-generated Method Stub -         int[] Scorearr =New int[5] [2];//defines a two-dimensional array for recording each game score -         intRedfang = 0; the         intBluefang = 0;//define the red and blue variables to determine the red and blue whole game win or lose -  -SYSTEM.OUT.PRINTLN ("*********** welcome into the volleyball scoring system ***********"); - System.out.println (); +          for(intj = 0;; J + +) { -System.out.println ("\ t Please select your action:"); +System.out.println ("1, start a game \t2, query a innings score \t3, exit"); AScanner scan =NewScanner (system.in); atString operate = Scan.next ();//Select the operating system -             if(J <5) { -                 Switch(operate) { -                  Case"1": {//start a new game -  -System.out.println ("The First" + (j + 1) + "innings contest begins!"); in                     BooleanFlog1 =false; -                     BooleanFLOG2 =false;//define the flag to determine the winner of the red and blue side of this game. to  +                     intRedscore = 0; -                     intBluescore = 0;//define the red and blue side base score for each game the  *                      for(inti = 0; I < 30; i++) { $System.out.println ("Current score: \n\t Red side:" + Redscore + "\ t blue:" +bluescore);Panax NotoginsengSYSTEM.OUT.PRINTLN ("Please select the additional team serial number: \N\T1, Blue Square \t2, red side"); -                         intScore =scan.nextint (); the                         if(score==1| | score==2){ +                         if(score = = 1) {//add points for blue side ARedscore + = 2;//Red Square score +2 points the                             if(Redscore >= 5) {//the first to reach the score, then win +Scorearr[j][0] = Redscore;//write a red square fraction to a two-dimensional array -SCOREARR[J][1] = Bluescore;//writes the Blue Square fraction to a two-dimensional array $Flog1 =true;//Judging this council to win the Red Party $                                  Break; -}Else { -                                 Continue; the                             } - Wuyi                         } the                         if(score = = 2) {//add points for the red side -Bluescore + = 2;//Blue Square score +2 Wu                             //Be the first to reach, win -                             if(Redscore >= 5) { AboutScorearr[j][0] = Redscore;//Red Square fractions are written into a two-dimensional array $SCOREARR[J][1] = Bluescore;//write a blue square score into a two-dimensional array -FLOG2 =true;//Judging This council's competition, blue wins . -  -                                  Break; A}Else { +                                 Continue; the                             } -                         } $}Else{ theSYSTEM.OUT.PRINTLN ("Input does not meet the requirements, please re-enter"); the                         } the                          the                     } -SYSTEM.OUT.PRINTLN ("This council game is over!") "); inSystem.out.println ("Score: \t\t Red side:" + Redscore + "Blue side:" +bluescore); the                     if(FLOG1) {//if the blue square flog1 is true theredfang++;//Blue Square score +1 AboutSystem.out.println ("The Red victory of this Council"); the                         if(Redfang >= 3) {//Blue Square score = 3, Blue win theSystem.err.println ("Race Red victory, all game over!") Please select another action: "); the                         } +                     } -                     if(FLOG2) {//Ibid . thebluefang++;BayiSystem.out.println ("T-win the blue side of this Council"); the                         if(Bluefang >= 3) { theSystem.err.println ("Match Blue win, all game over!") "); -                         } -                     } the                     Continue; the                 } the                  Case"2": theSYSTEM.OUT.PRINTLN ("which bureau you want to check for scores:"); -                     intChoisej =scan.nextint (); the                     //output a two-dimensional array corresponding to the score theSystem.out.print ("Blue side: Red Square ==>"); theSystem.out.print (Scorearr[choisej-1][0] + ":");94System.out.println (scorearr[choisej-1][1]); the                      Break; the                  Case"3": theSystem.exit (0);98                      Break; About                 } -                 Continue;101}Else {102System.err.println ("The game is all over!") Please select another action: ");103                 Continue;104             } the 106         }107 108     }109  the}

This is the first iteration of the job, the content is probably complete, the functionality has been implemented.

Because many uses have forgotten, in the classmate's help to complete this work, the result of the operation in the console, no interface, the operation is not convenient, the future will be gradually improved.

First iteration Job

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.