Given two variables , isEmpty of type boolean , indicating whether a class roster is empty or not, and numberOfCredits of type integer , containing the number of credits for a class , write an expression that evaluates to true if the class roster is not empty and the class is one or three credits.

Given two variables , isEmpty of type boolean , indicating whether a class roster is empty or not, and numberOfCredits of type integer , containing the number of credits for a class , write an expression that evaluates to true if the class roster is not empty and the class is one or three credits.

LANGUAGE: JAVA

CHALLENGE:

Given two variables , isEmpty of type boolean , indicating whether a class roster is empty or not, and numberOfCredits of type integer , containing the number of credits for a class , write an expression that evaluates to true if the class roster is not empty and the class is one or three credits.

SOLUTION:

(isEmpty == false) && (numberOfCredits == 3 || numberOfCredits == 1)

Add comment