- import java.io.Console;
- public class ch13
- {
- public static void main(String args[])
- {
- Console c=System.console();
- String str;
- int x,y;
- System.out.print("請輸入你的分數: ");
- x=Integer.parseInt(c.readLine());
- y=x/10;
- switch(y)
- {
- case 10:
- case 9:
- str="優";
- break;
- case 8:
- str="甲";
- break;
- case 7:
- str="乙";
- break;
- case 6:
- str="丙";
- break;
- case 5:
- case 4:
- case 3:
- case 2:
- case 1:
- str="丁";
- break;
- default:
- str="輸入錯誤";
- }
- System.out.print(str);
- }
- }
複製代碼 |