Java Basics---Advanced exercises (28)

Source: Internet
Author: User

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)

Related Article

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.