Results 1 to 4 of 4
- 10-04-2011, 07:44 PM #1
Member
- Join Date
- Oct 2011
- Posts
- 2
- Rep Power
- 0
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 #2
- Join Date
- Sep 2008
- Location
- Voorschoten, the Netherlands
- Posts
- 11,394
- Blog Entries
- 7
- Rep Power
- 17
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,
JosWhen people rob a bank they get a penalty; when banks rob people they get a bonus.
- 10-07-2011, 10:59 PM #3
Member
- Join Date
- Oct 2011
- Posts
- 2
- Rep Power
- 0
Re: I thought this would be an interesting thing to try...
yes the console. thanks
- 10-08-2011, 08:47 AM #4
- Join Date
- Sep 2008
- Location
- Voorschoten, the Netherlands
- Posts
- 11,394
- Blog Entries
- 7
- Rep Power
- 17
Re: I thought this would be an interesting thing to try...
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,
JosWhen people rob a bank they get a penalty; when banks rob people they get a bonus.
Similar Threads
-
Thought I'd try again
By elliotHenry in forum New To JavaReplies: 1Last Post: 03-29-2011, 11:03 PM -
Interesting CS problem. Need help.
By xtrmi in forum New To JavaReplies: 1Last Post: 05-02-2009, 03:51 AM -
**** Penny for a thought ****
By dododidi in forum New To JavaReplies: 5Last Post: 03-24-2009, 01:12 AM -
Interesting Experiment
By uncommon in forum Advanced JavaReplies: 13Last Post: 12-20-2008, 11:30 PM -
Learning java is harder than I thought.
By 2ndis1stplaceloser in forum IntroductionsReplies: 1Last Post: 10-21-2008, 01:52 PM


LinkBack URL
About LinkBacks
Reply With Quote

Bookmarks