- import java.io.Console;
- public class ch11
- {
- public static void main(String[] args)
- {
- int score,level;
- Console c=System.console();
- System.out.print("請輸入成績: ");
- score=Integer.parseInt(c.readLine());
- level=score/10;
- switch(level)
- {
- case 10: case 9:
- System.out.println("優");
- break;
- case 8:
- System.out.println("甲");
- break;
- case 7:
- System.out.println("乙");
- break;
- case 6:
- System.out.println("丙");
- break;
- case 5: case 4: case 3: case 2:
- case 1: case 0:
- System.out.println("丁");
- break;
- default:
- run();
- }
-
- }
- static void run()
- {
- System.out.println("輸入錯誤!");
- while(true)
- System.out.println("去吃屎!!!!!!!");
-
- }
- }
複製代碼 |