Program code:
Package Fangwei;
Import Java.util.Scanner;
Get the user's input score with the scanner tool
The scanner class is located in Java. Util package, to import this package
public class First {
public static void Main (String[]args) {
Scanner input=new Scanner (system.in);//Create Scanner Object
System.out.println ("Please enter exam results");
Variable Save score
int score =input.nextint ();//Get the score information entered by the user
Variables are saved in addition to the number of times
int count = 0;
System.out.println ("Pre-bonus score:" +score);//print output plus points before the score
while (score<60) {
score++;
count++;
}
As long as the score is less than 60, the circle knows the bonus points and count the number of points
System.out.println ("Bonus score:" + score);
SYSTEM.OUT.PRINTLN ("Total plus" + count + "+ times");
}
}
This article is from "Ghost" blog, please make sure to keep this source http://caizi.blog.51cto.com/5234706/1547823
Java Basics---Advanced exercises (28)