overlap radius... help me..

Discussion in 'Java' started by tepong, Aug 21, 2010.

  1. tepong

    tepong New Member

    Joined:
    Aug 21, 2010
    Messages:
    1
    Likes Received:
    0
    Trophy Points:
    0
    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. virxen

    virxen Active Member

    Joined:
    Nov 24, 2009
    Messages:
    387
    Likes Received:
    90
    Trophy Points:
    28
    start writing code ,start with what you know ,for example the class skeleton,
    constructors,etc.

    post here your code and i will debug it for you and i will assist you in what you do not know.
     

Share This Page

  1. This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
    By continuing to use this site, you are consenting to our use of cookies.
    Dismiss Notice