Another IF-THEN-ELSE-END IF
.
You can think of the task decide between tea and milk as a "little program." It happens to be part of a larger program, but that is OK. Remember this fact from chapter 16:
A small task, part of the design for a complete program, is itself a small problem. The plan for solving this small problem will have its own control structures.
The skeleton for the complete program looks like:
ask if customer wants coffee IF customer wants coffee THEN charge for coffee ELSE ' decide between tea and milk ask if customer wants tea IF customer wants tea THEN charge customer for tea ELSE charge customer for milk END IF END IF END
The choice between the three items can be made by asking two questions. The second question is asked only if the first question is answered "no."
Are the brackets (IF
, and END IF
)
properly balanced?