第6周作业2-IF语句大显身手之成绩判断

来源:互联网 发布:淘宝店铺导航条 css 编辑:程序博客网 时间:2024/05/16 04:39
package homework;import java.util.Scanner;public class GradeIf {public static void main(String[] args){double score;System.out.println("Enter an int value:");             Scanner sc=new Scanner(System.in);while(sc.hasNextDouble())            {  score=sc.nextDouble();if(score>=85)System.out.println("A");else if(score>=70&score<85)System.out.println("B");else if(score>=60&score<70)System.out.println("C");else if(score<60)System.out.println("D");}sc.close();}}

0 0
原创粉丝点击