← all problems

Declare a student record 🌶️

A student is taking 6 courses, has a GPA of 3.5, is currently enrolled, and is named Maria. Write code in the box that declares four variables and gives each the right value: an int named numberOfCourses, a double named gpa, a boolean named isEnrolled, and a String named studentName. The four locked lines at the bottom print them (the third one prints the opposite of isEnrolled, so it only works if isEnrolled really is a boolean). Choose each variable's type carefully, the tests check if you did.

Main.java — the program frame below is already written; you're only completing the code in the editable box.

public class Main {
    public static void main(String[] args) {
        // ---- write your code below ----
        System.out.println(numberOfCourses);
        System.out.println(gpa);
        System.out.println(!isEnrolled);
        System.out.println(studentName);
    }
}