import java.util.*; public class Test { public static void main(final String[] args) { int score; final Scanner rd=new Scanner(System.in); System.out.println("请输入成绩:"); score=rd.nextInt(); final int n=score/10; switch(n) { case 10: case 9:System.out.println("成绩为优="+score); break; case 8:System.out.println("成绩为良="+score); break; case 7:System.out.println("成绩为中="+score); break; case 6:System.out.println("成绩为及格="+score); break; default:System.out.println("成绩为差="+score); } } }