CommencerCommencer gratuitement

Grade some more

People were so pleased with the custom messages that the authorities now want you to go further in your system. There is a system of mentions in the school, by levels of 2 points starting from 10. You were asked to make sure that students failing were caught early in your code.

Cet exercice fait partie du cours

Intermediate Java

Afficher le cours

Instructions

  • Catch failing grades, lower than 10, early.
  • Fill in the correct keyword(s) to catch grades lower than 18.
  • Make sure all other grades receive "With highest distinction".

Exercice interactif pratique

Essayez cet exercice en complétant cet exemple de code.

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

        // Catch failing grades lower than 10
        if (grade < 10) {
            System.out.println("Failing grade");
        } else if (grade < 14) {
            System.out.println("Passing grade");
        // Fill in the correct keyword    
        } ____ ____ (____ ____ ____) {
            System.out.println("With distinction");
        // Fill in the correct keyword    
        } ____ {
            System.out.println("With highest distinction");
        }
    }
}
Modifier et exécuter le code