- import java.lang.*;
- import java.io.Console;
- public class ch09
- {
- public static void main(String args[])
- {
- Console console=System.console();
- int score;
- int level;
- System.out.print("請輸入你的成績: ");
- score=Integer.parseInt(console.readLine());
- level=score/10;
- switch(level)
- {
- case 10:
- System.out.println("哇滿分!太神了!");
- break; //跳出
- case 6: case 7: case 8: case 9:
- System.out.println("恭喜你及格了!");
- break;
- case 0: case 1: case 2: case 3: case 4: case 5:
- System.out.println("不及格!下次再努力!");
- break;
- default:
- System.out.println("輸入錯誤!");
- }
- }
- }
複製代碼 |