Academic Integrity: tutoring, explanations, and feedback — we don’t complete graded work or submit on a student’s behalf.

When I run this is, there are no errors. However, it does not produce these imag

ID: 3813102 • Letter: W

Question

When I run this is, there are no errors. However, it does not produce these images via command line arguments. What's the issue?

public class Circles {
  
public static void main(String args[]){
  
int n = Integer.parseInt(args[0]); // number of circles
double p = Integer.parseInt(args[1]); // probability of circle being black or white
double minr = Double.parseDouble(args[2]); // min radius
double maxr = Double.parseDouble(args[3]); // max radius
double randomr = Math.random() * (maxr - minr) + minr;
double x = Math.random() * 2.0 - 1.0; // random double between -1,1
double y = Math.random() * 2.0 - 1.0; // random double between -1,1
  
  
StdDraw.setScale(-1,1);
  
for (int i = 0; i <= n; i++){
if (Math.random() > p) {
StdDraw.setPenColor();
StdDraw.filledCircle( x , y, randomr);
}
else{
StdDraw.setPenColor(StdDraw.WHITE);
StdDraw.filledCircle( x , y, randomr);
}
}
}
}
  

1.5.26 Write a program circles that draws filled circles of random size at ran- dom positions in the unit square, producing images like those below. Your program should take four command-line arguments: the number of circles, the probability that each circle is black, the minimum radius, and the maximum radius. 200 1.01.01 500.5.01.05 50.75.1.2 100 1.01.05

Explanation / Answer

Steps you need to follow in order to used StdDraw

P.S: At Chegg, we aren't allowed to use url links in any of our answers but here, it was really required. So, here's the link for the download:

http://introcs.cs.princeton.edu/java/stdlib/

Hire Me For All Your Tutoring Needs
Integrity-first tutoring: clear explanations, guidance, and feedback.
Drop an Email at
drjack9650@gmail.com
Chat Now And Get Quote