Answer:
Step-by-step explanation:
The following code is written in Python. It creates the simulate method which takes in an argument for the max number of hops and the goal distance. Then it loops the number for the max number of hops and asks the user for a hop input using the hopDistance() method (which was not included so it was made, this can be removed if wanted). Then it updates position. If after the max hops goal was reached it returns True, otherwise it returns False.
def simulate(max, goal):
position = 0
print("Goal is " + str(goal))
for x in range(max):
hop = hopDistance()
position += int(hop)
if position >= goal:
return True
else:
return False
def hopDistance():
return input("Frog Hop Distance this hop: ")
print(simulate(4, 20))