PRACTICE: Loops and conditions to control program flow

Sensor methods: write the if statement to be used in by a Jeroo named Ky for each of these:

  1. Does this Jeroo named Ky have any flowers?
  2. Is Ky facing West?
  3. Is there a flower here where Ky is standing?
  4. Is there another Jeroo to the left of Ky?
  5. Is there a net ahead of Ky?
  6. Is there water to the right of Ky?
  7. Is there a clear space here where Ky is standing?
    (A clear space contains no flower, no net, no water, and no Jeroo. )
  1. _____________________
  2. _____________________
  3. _____________________
  4. _____________________
  5. _____________________
  6. _____________________
  7. _____________________

Boolean expressions: Write the code for each of these expressions:

  1. Is there water to the right of tom? ______________________________________
  2. Is alice facing North? _______________________________________
  3. Does peter have any flowers? ______________________________________________
  4. Is there a flower in the square where anthony is standing? ________________________________

Write these complete IF statements:

  1. If ellis has flowers, then ellis should plant a flower, otherwise he should pick a flower.

  2.  


  3. If there is a net ahead of walter,he turns right , otherwise he hops

     


Use the HELP feature in Jeroo to finish these notes:

  1. The if structure: The if structure is used to define ___________________________________
  2. In the if-else structure only ____________________________ will be executed.
  3. In the cascaded-if structure, if all conditions are false _________________________ will be executed.
  4. The pretest while structure is used to define a block of code that will be __________________________ as long as _________________________________________.