- import java.io.Console;
- public class c6
- {
- public static void main(String args[])
- {
- int a,b;
- Console c=System.console();
- System.out.print("請輸入成績: ");
- a=Integer.parseInt(c.readLine());
- b=a/10;
- switch(b)
- {
- 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:
- System.out.println("輸入錯誤!");
- }
- }
- }
複製代碼 |