Source: http://www.imooc.com/code/1554
Small partners, according to the knowledge, refer to the comments, the code Editor in the code to complement the complete, to achieve the score bonus function.
function Description: add points for the specified scores until the score is greater than or equal to 60, output the score before and after the addition score, and count the number of bonus points
Operating effect:
Task
warm tip : Try to do their own independent completion, Wood has the idea of the table is anxious. In the next 3 subsections, the @laurenyang will explain the analytical ideas of this section of the exercise, the optimized scheme, and how to assist with code development through the debugging capabilities of Eclipse
1 Public classHelloWorld {2 Public Static voidMain (string[] args) {3 4 //Variable Save score5 intScore = 53; 6 7 //variables are saved in addition to the number of times8 intCount = 0;9 Ten One //print output plus pre-score A - - the //as long as the score is less than 60, the loop performs the add-on operation and counts the number of points - - - + - + A at //print output plus score, plus number of points - - - - - } in}
1 Public classHelloWorld {2 Public Static voidMain (string[] args) {3 4 //Variable Save score5 intScore = 53; 6 7 //variables are saved in addition to the number of times8 intCount = 0;9 Ten One //print output plus pre-score ASystem.out.println ("Pre-bonus score:" +score); - - the //as long as the score is less than 60, the loop performs the add-on operation and counts the number of points - for(; score + count <; count++) { - - } + - + A at //print output plus score, plus number of points -System.out.println ("Bonus score:" + (score +count)); -System.out.println ("A total of" +count+ "Times!")); - - - } in}
Web-android Engineer first-5-1 programming exercises