Question: I'm trying to plot random points within a box of size 10 and when I run it, it doesn't plot anything. What's the issue?: import

I'm trying to plot random points within a box of size 10 and when I run it, it doesn't plot anything. What's the issue?:

import java.util.Random;

public class Question1 { public static void main(String args[]){ StdDraw.setXscale(-5.0,5.0); // set up scale for square of length 10 StdDraw.setYscale(-5.0,5.0); int N = Integer.parseInt(args[0]); // number of points input by user Random coords = new Random(); StdDraw.setPenColor(StdDraw.BLACK); // sets pen color to black for (int point = 0; point < N; point++ ){ double x = coords.nextDouble() * 10.0 - 5.0; // x and y coords for random point between -5 and 5 double y = coords.nextDouble() * 10.0 - 5.0; StdDraw.point(x,y); // draws point } } }

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!