Question: I have this track in Java using StdDraw. How can I implement limits for the coordinates x and y, so it only works within the

I have this track in Java using StdDraw. How can I implement limits for the coordinates x and y, so it only works within the borders? I was thinking if statements could do it, but I don't know how to implement it because of the corners.

I have this track in Java using StdDraw. How can I implement

limits for the coordinates x and y, so it only works within

244 245 246 247 public static void track20 I int n 40 int r1- 9, r2-3; int x1 = r1+1, x2 = n/2, x3 = n-(r1+1) ; int y1 = r1+1, y2 = n-2*t1+1, y3 = x3 ; 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 StdDraw.setCanvasSize(800, 800); // Adjust the size of the window StdDraw.setScale(0,n); // Set size of the coordinate system StdDraw.clear; StdDraw.setPenColor(StdDraw. LIGHT_GRAY; StdDraw.filledSquare(n/2.0, n/2.0, n/2.0); StdDraw.setPenColor(StdDraw. BLACK); StdDraw.setPenRadius(9.0/((double)n*50.0)); StdDraw.square(n/2.0, n/2.0,n/2.0); StdDraw.setPenRadius(4.0/(Cdouble)n*100.0)); for(int i = 1; i

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!