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