
144 ◾ Computational Thinking for the Modern Problem Solver
CONDITION produces a value of true, then the IF-TRUE-ACTIONS are
executed, otherwise the IF-FALSE-ACTIONS are executed.
Using this notation, we can now write a program that more e-
ciently expresses the shipping cost policy for our online shopping site.
Figure5.12 shows how the owchart of Figure5.10 can be expressed as a
computable algorithm.
Aer the orderAmount is obtained in line 1, the program will select
either the action on line 3 or the action on line 5 depending upon the
condition. In this example, the condition is given as “orderAmount < 40”.
When this condition is tr ...