Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Java program I have the following track, and would like the program to register that the car is crashed, when it is outside the lines.

Java program

I have the following "track", and would like the program to register that the car is crashed, when it is outside the lines. So I got it working for a simple track by using StdDraw.text(size/2, size/2, "You crashed!"), when the terms were met, but am having issues handling this one. If anyone can show me hot to remove the grid outside the track, that would be great too!

image text in transcribed

image text in transcribed

image text in transcribed

public static void track2O i 235 236 237 int scale = 10; int n - 4*scale; // The final size of the field 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 StdDraw. setCanvasSize(800, 800); // Adjust the size of the window StdDraw. setScale(0,n); /I Set size of the coordinate system StdDraw.clearQ; StdDraw. setPenColor(StdDraw. LIGHT_GRA); 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/((double)n*100.0)); for(int i = 1; i

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Sql++ For Sql Users A Tutorial

Authors: Don Chamberlin

1st Edition

0692184503, 978-0692184509

More Books

Students also viewed these Databases questions