Bắt đầu ngayBắt đầu miễn phí

Grading

In your school, students get their grades online. You want to make sure that students get complimented when strictly above 11, but also that they get a clear message when it is failed. The grades go from 0 to 20, and 10 is the passing grade.

Bài tập này là một phần của khóa học

Intermediate Java

Xem khóa học

Hướng dẫn bài tập

  • Use the correct operator and number to make sure that grades strictly above 11 get a compliment.
  • Use the correct keywords to make sure that it is entered only if the previous condition is false and something else is met.
  • Use the proper keyword to catch all other cases.

Bài tập tương tác thực hành trực tiếp

Hãy thử làm bài tập này bằng cách hoàn thành đoạn mã mẫu này.

class Grader {
  public static void main(String[] args) {
    int grade = 14;

    // Check if the grade is above 11
    if (grade ____ ____) {
      System.out.println("You've outdone yourself");
      // If the above condition is not met, check if the grade is at least 10
    } ____ ____ (grade >= 10) {
      System.out.println("You get a passing grade");
      // Add the correct keyword to grab every other possible case
    } ____ {
      System.out.println("You get a failing grade");
    }
  }
}
Chỉnh sửa và Chạy Mã