Question: In this laboratory assignment, you will be writing a custom Jeroo subclass, but this time one that can deal with unknown distances and quantities. Your
In this laboratory assignment, you will be writing a custom Jeroo subclass, but this time one that can deal with unknown distances and quantities. Your Jeroo will start off on an island containing a line of flowers and a long, straight line of nets, but you won't know how many flowers there are or where the line of nets is located. You will need to navigate your Jeroo to collect all of the flowers, then find the line of nets, and finally use the flowers to disable as many of the nets as possiblethere might be more nets, or more flowers, but you won't know which.
Devise a plan for how you will accomplish the task in this labcollecting the flowers and disabling the nets. Write your plan in the form of comments in your Jeroo's pickFlowersAndDisableNets method.
Some questions to keep in mind when planning:
What can you assume will always be the same each time you run your program? What will be different?
How will you find the first net? What about the second?
Think carefully about which of your steps will make meaningful methods. Pick good names for your methods. As an example, remember that we wrote this method in class you can use it as a general pattern for creating your own methods for this lab:
Devise a plan for how you will accomplish the task in this labcollecting the flowers and disabling the nets. Write your plan in the form of comments in your Jeroo's pickFlowersAndDisableNets method.
Some questions to keep in mind when planning:
What can you assume will always be the same each time you run your program? What will be different?
How will you find the first net? What about the second?
Think carefully about which of your steps will make meaningful methods. Pick good names for your methods. As an example, remember that we wrote this method in class you can use it as a general pattern for creating your own methods for this lab:
public void pickFlowers
while thisseesFlowerAHEAD
this.hop;
this.pick;
It's tempting to write a whole solution and then test it but that will make finding any bugs much harder. Instead, it's better to work incrementally to write and check that a single step in your plan works before moving on to the next. Feel free to write stubs for your own methods.
Test each piece of your solution as you go As you add pieces of your solution, don't forget to save your code and run it to confirm that it works as you expect. Fix any problems you see.
Don't forget to use while loops when you need to repeat an action, and ifthenelse structures when you wish to choose between alternate actions. You can review information on ifthenthen, ifthen, and while loops in : Conditional and Repeating Actions. The basic form of these structures is shown below for reference:
Step by Step Solution
There are 3 Steps involved in it
1 Expert Approved Answer
Step: 1 Unlock
Question Has Been Solved by an Expert!
Get step-by-step solutions from verified subject matter experts
Step: 2 Unlock
Step: 3 Unlock
