Curent modified code //imports import java.io.BufferedReader; import java.io.IOException; import java.io.InputStreamReader; import view.GreyscaleHitViewerFrame; public class mandlebot { public static void main(String[] args) { { int gridSize = 200; // The grid size is 200x200 double y = 0,x = 0,test = 0,area = 0,r1 = 0,r2 = 0,minX = -2,maxX = 2,minY = -2,maxY = 2; //variables for calculation double counter = 0; //initialise the counter variable (counts whether a specific square is covered by the annulus) double hits[][] = new double[gridSize][gridSize]; double random = Math.random(); final int SAMPLES = 100; final int MAX_STEPS = 225; BufferedReader input= new BufferedReader(new InputStreamReader(System.in)); { //get r1 deleted //get r2 deleted while (r2 >= r1); //if r2 is greater or equal to r1, ask again (it can't be or its not an annulus) //calculations for(int column=0; column r2 * r2) //Pythagorus to work out if the point is inside the outer circle { //and outside the inner circle counter++; hits[column][row] = hits[column][row] + 1; } //Pythagorus to work out if the point is inside the outer circle } } area = (maxX-minX) * (maxY-minY) * counter / (gridSize * gridSize); //print end result System.out.println("Area : " + area + "\n"); } (new GreyscaleHitViewerFrame("Annulus", gridSize, gridSize)).viewHits(hits);} } } What I need to do: Next, find the place in your code where you test whether or not (x,y) is on the shape, and replace it with this code: boolean inside = true; int steps = 0; CSP1150/4150 Programming Principles page 6 double px = 0; double py = 0; while(steps < MAX_STEPS && inside) { inside = px*px + py*py < 4.0; double py1 = 2*px*py + y; px = px*px - py*py + x; py = py1; steps++; } • Change your code to use the value of inside to decide whether to increment the hit count for the cell.