Say that you enter 9 for FLOUR and 1 for SUGAR.

Answer:

               
FLOUR >= 4    true     

SUGAR >= 2    false  

Logical Expressions

Here is the program again:

' Cookie Ingredients Checker
'
PRINT "How much flour do you have"
INPUT FLOUR
PRINT "How much sugar do you have"
INPUT SUGAR
'
IF FLOUR >= 4 AND SUGAR >= 2 THEN
  PRINT "You have enough ingredients"
ELSE
  PRINT "You do not have enough"
END IF
'
END

For you to have enough ingredients, both relational expressions must be TRUE. This is the role of the AND between the two relational expressions. The AND requires that both

FLOUR >= 4 

and

SUGAR >= 2 

are true before the entire question is true. The entire question must be true in order for the true branch to execute.

The two part question is an example of a logical expression. A logical expression looks at the TRUE and FALSE answers of relational expressions. It will itself give you a TRUE or FALSE.

QUESTION 4:

Look at the program. How will the monitor screen look if the user types 6 for FLOUR and 4 for SUGAR?