-6

I am in dire need of help. I have tried multiple ways to do this and cannot succeed. My problem is:

Create a program that displays a random number of blue Circles (from 0 to 3) with a random diameter and location.

In other words, I have to create a random number of blue circles (between 0 to 3 random circles) that have a random location and diameter. Please help soon! Anything will be appreciated. Im running off of eclipse.

Andy Turner
  • 137,514
  • 11
  • 162
  • 243
  • 4
    What have you tried? What **specific** problem do you have that you're stuck on? What does your code look like... We cannot deduce what it is that you're asking if you don't give enough information. Or are you just asking us to provide code? Because SO is not a coding service... – QBrute Nov 03 '16 at 07:58

2 Answers2

2

This sounds like you want us to do your homework, and that won't work. So here are just some thoughts to get you going:

  1. You can see here how to generate random int numbers within a given range.
  2. You use that functionality to create random x,y coordinates for your circle center, and a random d diameter.
  3. Then you use that information and follow this here to draw circles.
Community
  • 1
  • 1
GhostCat
  • 137,827
  • 25
  • 176
  • 248
0

would be helpful to see the code you tried, i'm guessing u used java Math class for it's random function, but in case you mistyped it overall look of the function is:

    (int)(Math.random() * (max - min) + min)

max represents your highest number possible, and min the lowset number possible.

Zilbers
  • 21
  • 2