返回列表 發帖
  1. import java.io.Console;
  2. public class ch12
  3. {
  4.     public static void main(String args[])
  5.     {
  6.         Console c=System.console();
  7.         int score,level;
  8.         System.out.print("請輸入成績:");
  9.         score=Integer.parseInt(c.readLine());
  10.         level=score/10;
  11.         switch(level)
  12.         {
  13.         case 10:
  14.         case 9:
  15.           System.out.println("優");
  16.           break;
  17.          case 8:
  18.           System.out.println("甲");
  19.           break;
  20.          case 7:
  21.           System.out.println("乙");
  22.           break;
  23.          case 6:
  24.           System.out.println("丙");
  25.           break;
  26.          case 5:
  27.          case 4:
  28.          case 3:
  29.          case 2:
  30.          case 1:
  31.          case 0:
  32.           System.out.println("丙");
  33.           break;
  34.         default:
  35.         System.out.println("輸入錯誤!");
  36.        }
  37.     }
  38. }
複製代碼

TOP

返回列表