package com.company; import java.util.Scanner; public class Main { public static void main(String arg[]) { System.out.println("请输入一门成绩:"); Scanner input = new Scanner(System.in); float score = input.nextFloat(); switch ((int) score / 10) { case 10: System.out.println("成绩为A等级"); break; case 9: System.out.println("成绩为B等级"); break; case 8: System.out.println("成绩为C等级"); break; case 7: System.out.println("成绩为D等级"); break; case 6: System.out.println("成绩为E等级"); break; default: System.out.println("成绩不好,还要继续努力哦!"); } } }