输入成绩判断等级--Scanner

import java.util.Scanner;
public class Score {
    public static void main(String[] args){
        System.out.println("请输入你的成绩");
        Scanner sc=new Scanner(System.in);
        int score=sc.nextInt();
        switch(score/10){
            case 10:
                System.out.println("A等");
                break;

            case 9:
                System.out.println("A等");
                break;

            case 8:
                System.out.println("B等");
                break;

            case 7:
                System.out.println("C等");
                break;

            case 6:
                System.out.println("D等");
                break;

            default:
                System.out.println("E等");
                break;
        }
    }
}

显示结果:

请输入你的成绩
100
A等

你可能感兴趣的:(输入成绩判断等级--Scanner)