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);
}
}
}
}
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/
Related Questions
drjack9650@gmail.com
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.