Challenge problems using loops


Break Free (uses islands: breakOut1, breakOut2 and breakOut3)

A Jeroo starts out in the middle of an island at (12,12) with 4 flowers. It must use it's flowers to break out of the encircling nets to reach the outer shore of the island. The program must use loops in the solution.

Create a method called findNet() that tells a Jeroo to keep hopping until it is facing a net.

Create a method called throughNet() that tells a Jeroo to use the findNet() method to find a net and then to toss a flower at the net to disable it.

Fill out the TAG sheet when finished.


Connect-the-dots. (uses islands Dot1 and Dot2)

  • A jeroo starts out in the middle of an island at (12,12) with 999 flowers. It travels north, planting flowers as it goes until it finds a flower straight ahead. Then the Jeroo looks to the left and right to decide what to do next.
    • If there is a flower only on the right, the Jeroo turns to the left and continues planting until it runs into another flower.
    • If there is a flower only on the left, the Jeroo turns to the right and continues planting.
    • If there are flowers on both the left and right, the Jeroo stops.

Print code with GOOD STYLE. (comments, indentation, good method names)

MineSweeper. A jeroo with 46 flowers in its pouch travels across an island one time from East to West disabling every net it finds in its path and replacing the net with a flower (first, toss a flower at the net to disable it, then hop forward and plant another flower to replace the net). Create a method called replaceNet() and another method called findNet() . The main program must use a loop to continuously find and replace nets until the shore is reached. This should work for any island. Save as MineSweeper.