- import java.io.Console;
- public class ch09
- {
- public static void main (String showdemo[])
- {
- Console console=System.console();
- int score;
- int level;
- System.out.print("Please input your score =");
- score=Integer.parseInt(console.readLine());
- level=score/10;
- switch(level)
- {
- case 10 :
- System.out.println("有作弊嗎? 太神了");
- break;
- case 9: case 8: case 7:case 6:
- System.out.println("恭喜及格了!!");
- break;
- case 5:case 4:case 3:case 2:case 1:
- System.out.println("成績不及格!!");
- break;
- case 0:
- if (score >0)
- {
- System.out.println("成績不及格!!");
- }
- else
- {
- System.out.println("鴨蛋喔!!");
- }
- break;
- default :
- System.out.println("輸入錯誤,你是來亂的嗎?");
- }
- }
- }
複製代碼 |