返回列表 發帖
本帖最後由 蔡明蓉 於 2019-8-2 15:18 編輯
  1. import java.nio.file.attribute.FileOwnerAttributeView;
  2. import java.util.Scanner;
  3. public class Ch44
  4. {
  5.     public static void main(String[] args)
  6.     {
  7.         while(true)
  8.            {
  9.              Scanner s=new Scanner(System.in);
  10.              float score;
  11.              String str;
  12.              System.out.print("請輸入你的成績");
  13.              score=s.nextFloat();
  14.              if(score>=90&&score<=100)
  15.                  str="優";
  16.              else if(score>=80&&score<90)
  17.                  str="甲";
  18.              else if(score>=70&&score<80)
  19.                  str="乙";
  20.              else if(score>=60&&score<70)
  21.                  str="丙";
  22.              else if(score>=0&&score<60)
  23.                  str="丁";
  24.              else
  25.                  str="!!!!!輸入錯誤!!!!!";
  26.              System.out.println(str);
  27.              System.out.println();       
  28.            }
  29.     }
  30. }
複製代碼

TOP

返回列表