Do you want pin stripes (0 or 1)? 1 Do you want anti-lock brakes (0 or 1)? 0 Total cost is: $20250
This time, only the first true block was executed.
This flowchart shows how the program works:
Each true block of an if
statement
is like a "side-trip" that adds something
to the totalCost
.
Both, neither,
or just one side-trip might be taken.
What would happen if the user answered both questions by typing "2" instead of "1" ?