- FrogSimulation.java
Write the runSimulations
method, which performs a given number of simulations and returns the proportion of simulations in which the frog successfully reached or passed the goal. For example, if the parameter passed to runSimulations
is 400, and 100 of the 400 simulate
method calls returned true
, then the runSimulations
method should return 0.25
.
Complete method runSimulations
below. Assume that simulate
works as specified, regardless of what you wrote in part (a). You must use simulate
appropriately to receive full credit.
First attempt to complete this exercise in the free response to practice writing code without the ability to run it. When you think you’ve completed the task, copy your code from here and test it in the following activity.
Upload an image
Upload from your computer
Or paste a link here
Slides and Notes
No slides available for this video
About
Java (main)
Java Version 1.8.0_222