public class WaterSpout { static double ySpread = 0.2; // Vertical distance between droplets. static double xSpread = 0.3; // Max horizontal movement. public static void main (String[] argv) { DrawTool.display (); DrawTool.setXYRange (0,10, 0,10); // Number of droplets. int n = 100; DrawTool.startAnimationMode (); // Initially, all will start in the middle at height 10. double[] x = makeXCoords (n, 5); double[] y = makeYCoords (n, 10); // As long as the last drop is above ground, simulate. while (y[n-1] > 0) { movePoints (x, y); drawPoints (x, y); DrawTool.animationPause (100); } DrawTool.endAnimationMode (); // Draw final landing points in blue. y = new double [n]; DrawTool.setPointColor ("blue"); drawPoints (x,y); } static double[] makeXCoords (int n, double initValue) { double[] x = new double [n]; for (int i=0; i= 0) && (y[i] <= 10)); DrawTool.drawPoint (x[i], y[i]); } } }