- import java.util.Scanner;
- public class Ch09 {
- public static void main(String[] args)
- {
- Scanner s=new Scanner(System.in);
- float score;
- System.out.print("請輸入你的成績:");
- score=s.nextFloat();
- if(score>=90 && score<=100)
- System.out.println("優");
- else if (score>=80 && score<90)
- System.out.println("甲");
- else if (score>=70 && score<80)
- System.out.println("乙");
- else if (score>=60 && score<70)
- System.out.println("丙");
- else if (score>=0 && score<60)
- System.out.println("丁");
- else
- System.out.println("輸入錯誤");
- }
- }
複製代碼 |