返回列表 發帖
  1. public class Ch02
  2. {

  3.         public static void main(String[] args)
  4.         {
  5.                 Scanner s=new Scanner(System.in);
  6.                 float score;
  7.                 String str;
  8.                 System.out.print("Enter your score: ");
  9.                 score=s.nextFloat();
  10.                 if(score>=90 && score<=100)
  11.                         str="A";
  12.                 else if(score>=80 && score<=90)
  13.                         str="B";
  14.                 else if(score>=70 && score<=80)
  15.                         str="C";
  16.                 else if(score>=60 && score<=170)
  17.                         str="D";
  18.                 else if(score>=0 && score<=60)
  19.                         str="E";
  20.                 else
  21.                         str="Wrong enter!";
  22.                 System.out.println(str);
  23.         }

  24. }
複製代碼

TOP

返回列表