键盘输入学生成绩(0到100)计算学生等级

import java.util.Scanner;
public class studentLevel {
    public static void main(String[] args) {


        Scanner sc = new Scanner(System.in);
        System.out.println("请输入成绩(0到100):");
        double score = sc.nextDouble();
        if (score >= 90 && score <= 100) {
            System.out.println('A');
        } else if (score >= 70 && score < 90) {
            System.out.println('B');
        } else if (score >= 60 && score < 70) {
            System.out.println('C');
        } else if (score < 60) {
            System.out.println('D');
        } else {
            System.out.println("输入的数字有误请重新输入");
            studentLevel.main(null);
        }
    }

}


版权声明:本文为qq_19301693原创文章,遵循CC 4.0 BY-SA版权协议,转载请附上原文出处链接和本声明。