Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

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

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

Pro SQL Server Wait Statistics

Authors: Enrico Van De Laar

1st Edition

1484211391, 9781484211397

More Books

Students also viewed these Databases questions