1. Problem definition : A Jeroo starts on the West Coast at row 11 column 0 facing East and navigates an island using the following rules:
2. Analysis. There are different islands to navigate so it's difficult to know ahead of time where the Jeroo will stop. The program requires a loop to keep going as long as the Jeroo is not on a flower. It would be good to have a simple test case with a known result to be sure the program works. The island, Navigate0, on the right starts with the Jeroo at 11,0 facing a net to the East, it should turn right and hop 4 spaces so it will be facing the water where it will turn left and hop 5 to the clear space, then hop 6 ahead to face the flower, turn right and hop 3 to land on the flower and stop. An important point in analyzing the problem is seeing that the Jeroo should check whether or not it is finished after each move.
(the solution is at the bottom of the page for the island Navigate1)
Answer these questions:
3. High-Level Algorithm.
3a. How will you say "Keep going as long as the Jeroo is not on a flower"?
3b. Will the if statements go inside the loop or outside the loop?
Note: The remaining high-level algorithm is already written in the comments above.
4. Detailed Algorithm. Will you use separate if/then statements or an if/else if statement? Why?
5. Review of solution. How will you know that your program works? If 2 people get the same results does that mean both programs work?
Solution: The Jeroo should finish on the island Navigate1 at location 9,19 facing North.