JAVA__IF_ELSE__ 's Notes

Source: Internet
Author: User

ImportJava.util.Scanner; Public classdome1{ Public Static voidMain (String []args) {Scanner input=NewScanner (system.in); floatScore;//Defining VariablesSystem.out.print ("Please enter your score");//Input VariablesScore = Input.nextint ();//assigning values to variables        if(score>100| | score<0) {//first, the score is greater than 100 or the score is less than 0System.out.print ("Invalid result");//Invalid output score}Else{Otherwise (in case of a valid result) the Judgmentif(score>=90&&score<=100) {//determine if the result is greater than or equal to 90 and less thanSystem.out.print ("A");//in judging the range of words output a, otherwise next judgment            }            Else if(score>=80&&score<=90) {//Otherwise you can judge whether the result is greater than or equal to 80 and less thanSystem.out.print ("B");//output B In the judging range, otherwise proceed to the next judgment.            }            Else if(score>=70&&score<=80) {//Otherwise you can judge whether the result is greater than or equal to 70 and less thanSystem.out.print ("C");//output C in the judging range, otherwise proceed to the next judgment.            }            Else if(score>=60&&score<=70) {//Otherwise you can judge whether the result is greater than or equal to 60 and less thanSystem.out.print ("D");//then judge the range, output D, or the next step.            }            Else{//judging the above 4 judgments are not valid, output ~ inferior latticeSystem.out.print ("fail");//output ~ less than grid            }        }                                            }        } 

JAVA__IF_ELSE__ 's Notes

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.