public class PoliceChase { public static void main (String[] argv) { DrawTool.display (); DrawTool.setXYRange (0,10, 0,10); DrawTool.startAnimationMode (); // Police-car acceleration, velocity, distance. double accP = 1; double velP = 0; double distP = 0; // Speeding-car acceleration, velocity, distance. double accS = 0; double velS = 1; double distS = 3; double delT = 0.1; for (double t=0; t<=10; t+=delT) { // Calculation and display of the speeding car's position. distS = distS + velS * delT; DrawTool.setPointColor ("red"); DrawTool.drawPoint (distS, 0); // Calculation and display of police car's position. velP = velP + accP * delT; distP = distP + velP * delT; DrawTool.setPointColor ("blue"); DrawTool.drawPoint (distP, 0); // Display the current time. DrawTool.writeTopValue (t); // Pause for animation effect. DrawTool.animationPause (100); } DrawTool.endAnimationMode (); } }