Question: public static int findEscapeCount(double x, double y, int maxIterations) Determines how many iterations of the following operation are required until the condition (a * a

public static int findEscapeCount(double x, double y, int maxIterations)

Determines how many iterations of the following operation are required until the condition (a * a + b * b) > 4 is reached:

 tempA = a * a - b * b + x tempB = 2 * a * b + y a = tempA b = tempB 

where a and b are initially zero, and x and y are given parameters. For example, with x = 1 and y = 0.5, after one iteration a should be 1 and b should be 0.5. After two iterations a should be 1.75 and b should be 1.5, at which point the method returns with value 2 since (1.75)2 + (1.5)2 = 5.3, which is greater than 4. If the condition (a * a + b * b) > 4 is not reached within maxIterations, the method just returns maxIterations.

Parameters:

x - given x value

y - given y value

maxIterations - maximum number of iterations to attempt

Returns:

number of iterations required to get (a * a + b * b) > 4, or maxIterations

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!