Results 1 to 4 of 4
  1. #1
    Azryo is offline Member
    Join Date
    Oct 2011
    Posts
    2
    Rep Power
    0

    Lightbulb 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!

  2. #2
    JosAH's Avatar
    JosAH is offline Moderator
    Join Date
    Sep 2008
    Location
    Voorschoten, the Netherlands
    Posts
    14,044
    Blog Entries
    7
    Rep Power
    23

    Default 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
    The only person who got everything done by Friday was Robinson Crusoe.

  3. #3
    Azryo is offline Member
    Join Date
    Oct 2011
    Posts
    2
    Rep Power
    0

    Default Re: I thought this would be an interesting thing to try...

    yes the console. thanks

  4. #4
    JosAH's Avatar
    JosAH is offline Moderator
    Join Date
    Sep 2008
    Location
    Voorschoten, the Netherlands
    Posts
    14,044
    Blog Entries
    7
    Rep Power
    23

    Default Re: I thought this would be an interesting thing to try...

    Quote Originally Posted by Azryo View Post
    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
    The only person who got everything done by Friday was Robinson Crusoe.

Similar Threads

  1. Thought I'd try again
    By elliotHenry in forum New To Java
    Replies: 1
    Last Post: 03-29-2011, 11:03 PM
  2. Interesting CS problem. Need help.
    By xtrmi in forum New To Java
    Replies: 1
    Last Post: 05-02-2009, 03:51 AM
  3. **** Penny for a thought ****
    By dododidi in forum New To Java
    Replies: 5
    Last Post: 03-24-2009, 02:12 AM
  4. Interesting Experiment
    By uncommon in forum Advanced Java
    Replies: 13
    Last Post: 12-21-2008, 12:30 AM
  5. Learning java is harder than I thought.
    By 2ndis1stplaceloser in forum Introductions
    Replies: 1
    Last Post: 10-21-2008, 01:52 PM

Tags for this Thread

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •