Results 1 to 2 of 2
  1. #1
    tepong is offline Member
    Join Date
    Aug 2010
    Posts
    2
    Rep Power
    0

    Default overlap radius... help me..

    Write a program that prompts the user to enter the center coordinates and radius of two circles and determines whether the second circle is inside the first or overlaps with the first.
    Hint: circle2 is inside circle1 if the distances between the two centers
    <=|r1 r2|

    circle2 overlaps circle1 if the distance between the two centers
    <=|r1 + r2|


    So i have found the correct formula but dont know how to write the coding. Can someone help me....
    circle2 is inside circle1 if:
    distance(x1,y1,x2,y2) <= Math.abs(r1-r2)

    circle2 overlaps circle1 if:
    distance(x1,y1,x2,y2) <= Math.abs(r1+r2

  2. #2
    Fubarable's Avatar
    Fubarable is offline Moderator
    Join Date
    Jun 2008
    Posts
    19,315
    Blog Entries
    1
    Rep Power
    26

    Default

    Quote Originally Posted by tepong View Post
    So i have found the correct formula but dont know how to write the coding. Can someone help me....
    The secret to success here is to break your problem down into small steps, and then attack each step one at a time. A great resource that can help you get started is this link: So, You Need to Write a Program but Don't Know How to Start

    Since we don't know where your stuck, it's difficult to help you. Just stating that you don't know how to write the code again leaves us with the option of referring you to the tutorials, and that's about it. You know of course that no one here is going to write this for you. Please have a look at the link above, and then try to do as much as you can to solve your problem. You probably can do more than you think you can. Then if you get stuck you can post your attempt, and we'll know how to help you.

    Best of luck!

Similar Threads

  1. coordinates and radius
    By tepong in forum New To Java
    Replies: 1
    Last Post: 08-21-2010, 07:38 PM
  2. [SOLVED] Best way to overlap Images?
    By Krooger in forum AWT / Swing
    Replies: 3
    Last Post: 06-08-2009, 07:12 PM
  3. java program help. find the radius of a circle
    By megironi in forum New To Java
    Replies: 1
    Last Post: 03-27-2009, 08:09 AM

Posting Permissions

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