Get startedGet started for free

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.

This exercise is part of the course

Intermediate Java

View Course

Exercise instructions

  • 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.

Hands-on interactive exercise

Have a go at this exercise by completing this sample code.

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");
    }
  }
}
Edit and Run Code