- class Demo
- {
- public static void main(String[] args)
- {
- getLevel(100);
- getLevel(94);
- getLevel(0);
- getLevel(-100);
- }
- public static void getLevel(int grace)
- {
- switch(grace/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;
- case 5:
- case 4:
- case 3:
- case 2:
- case 1:
- case 0:
- System.out.println("E");break;
- default:
- System.out.println("Wrong ");break;
- }
- }
复制代码
|