JAVA 成绩等级划分

  1. package 成绩等级;
    
    import com.sun.jdi.event.Event;
    import com.sun.jdi.event.ExceptionEvent;
    
    import java.util.Scanner;
    
    public class Score {
        public static void main(String[] args) {
            Scanner scanner = new Scanner(System.in);
            System.out.println("请输入成绩:");
            double score = scanner.nextDouble();
            scanner.close();
    //判断语句
            if (score > 100 || score < 0) {
                System.out.println("输入的成绩不在0~100的范围内");
            } else if (score >= 90) {
                System.out.println("A");
            } else if (score >= 80) {
                System.out.println("B");
            } else if (score >= 60) {
                System.out.println("C");
            } else {
                System.out.println("D");
            }
        }
    }

 

你可能感兴趣的:(学习分享)