Two-way Decisions

Classic programmed-learning exercises, refreshed for modern Java and presented in the current MrStyner.com portfolio style.

Modern Java noteThis archive has been refreshed for Java 25 LTS. Core language concepts remain useful, while outdated setup instructions and browser-era Java are labeled or replaced. Java 26 is the current feature release; Java 25 is used here as the stable teaching baseline.
go to previous page   go to home page   hear noise   go to next page

Answer:

On.

Two-way Decisions

[two way decision]

The windshield wipers are controlled with an ON-OFF switch. The flowchart at right shows how this decision is made.

Start at the top of the chart then follow the line to the question:

is it raining?

The answer is either true or false.

  • If the answer is true,
    • follow the line labeled True,
    • perform the instructions in the box "wipers on",
    • follow the line to "continue".
  • If the answer is false,
    • follow the line labeled False,
    • perform the instructions in the box "wipers off",
    • follow the line to "continue".

QUESTION 2:

How many ways can you go from "start" to "continue"?