Given two variables, isEmpty of type boolean, indicating whether a class roster is empty or not, and numberOfCredits of type int, 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 more than two credits.

Respuesta :

isEmpty of type boolean, indicating whether a class roster is empty or not.

numberOfCredits of type int, containing the number of credits for a class.

The expression that evaluates to true if the class roster is not empty is :

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

Explanation:

Two variables, isEmpty of type boolean, indicating whether a class roster is empty or not, and numberOfCredits of type int, containing the number of credits for a class.

An expression that evaluates to true if the class roster is not empty and the class is more than two credits is

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

If isEmpty is false, then the number of credits can be either three or one.

The statement shows the expression.