What does $message contain after the following code executes?

$age = 19;

$score = 750;

if ( $age >= 21 && $score >= 700 ) {

$message = 'Loan approved';

} else if ( $age >= 21 && $score >= 650 ) {

$message = 'Cosigner needed.';

} else if ( $age >= 18 && $score >= 680 ) {

$message = 'Two cosigners needed.';

} else {

$message = 'Loan denied.';

}

a. Loan approved.
b. Cosigner needed.
c. Two cosigners needed.
d. Load denied.

Respuesta :

Answer:

c. Two cosigners needed.

Explanation:

In the first if condition,

if ($age >= 21 && $score >= 700)

The age variable is set to 19, which is not >=21, so this condition is false.

In the second condition,

else if ($age >= 21 && $score >= 650)

Same story, age variable is equal to 19, which is not >=21, this condition is also false.

In the third condition,

else if ($age >= 18 && $score >= 680)

age condition is true because 19 is >=18, and score condition is also true, because 750 is >=680. So this condition is true.

Henceforth, variable message will contain the string "Two cosigners needed."