- import java.io.Console;
- public class XX
- {
- public static void main(String args[])
- {
- Console c=System.console();
- while (0<1)
- {
- float x;
- System.out.println("輸入成績(0~100): ");
- x=Float.parseFloat(c.readLine());
- if (90<=x&&x<=100)
- {
- System.out.println("優");
- }
- else if (80<=x&&x<=89)
- {
- System.out.println("甲");
- }
- else if (70<=x&&x<=79)
- {
- System.out.println("乙");
- }
- else if (60<=x&&x<=69)
- {
- System.out.println("丙");
- }
- else if (0<=x&&x<=59)
- {
- System.out.println("丁");
- }
- else
- {
- System.out.println("輸入錯誤,請重新輸入");
- System.out.println("********************");
- }
- }
- }
- }
複製代碼 |