返回列表 發帖
  1. import java.io.Console;
  2. public class ch13

  3. {
  4.     public static void main(String args[])
  5.     {
  6.         Console c=System.console();
  7.         int x,y;
  8.         System.out.print("請輸入成績: ");
  9.         x=Integer.parseInt(c.readLine());
  10.         System.out.println("您剛輸入的成績為"+x);
  11.         y=x/10;
  12.         switch(y)
  13.         {
  14.             case 10:
  15.             case 9:
  16.             System.out.println("優");
  17.             break;
  18.             case 8:
  19.             System.out.println("甲");
  20.             break;
  21.             case 7:
  22.             System.out.println("乙");
  23.             break;
  24.             case 6:
  25.             System.out.println("丙");
  26.             break;
  27.             case 5:
  28.             case 4:
  29.             case 3:
  30.             case 2:
  31.             case 1:
  32.             case 0:
  33.             System.out.println("丁");
  34.             break;
  35.             default:
  36.                 System.out.println("輸入錯誤");
  37.         }
  38.     }
  39. }
複製代碼

TOP

返回列表