# I thought this would be an interesting thing to try...

• 10-04-2011, 07:44 PM
Azryo
I thought this would be an interesting thing to try...
I am currently studying java and I am really into it. My professor was speaking about different kinds of things we should be able to do by now, and one of them he mentioned was making a circle out of asterisks. Two examples he gave were a circle inside a circle inside a circle and so on, and another one was a spiral of asterisks with no close. I am really not sure how to go about this now that I think about it, can anybody help me out so I can see how this would be done? Thanks!
• 10-04-2011, 07:54 PM
JosAH
Re: I thought this would be an interesting thing to try...
Do you want to draw that circle in a graphics component or on the console (your terminal). If it is the second option, you have to find a way to draw the circle from top to bottom, left to right or apply some tricks; your turn.

kind regards,

Jos
• 10-07-2011, 10:59 PM
Azryo
Re: I thought this would be an interesting thing to try...
yes the console. thanks
• 10-08-2011, 08:47 AM
JosAH
Re: I thought this would be an interesting thing to try...
Quote:

Originally Posted by Azryo
yes the console. thanks

Think in terms of angles; for the angles in the range [0, pi/2] you want to draw half of a circle with radius r (r is an int here because you can only print an int number of lines). So for each line the angle increases pi/2/r radians and the two stars to draw are at positions r+r*sin(a) and r-r*sin(a) where a is such an angle step.

kind regards,

Jos