Hello and welcome to our community! Is this your first visit?
Enjoy an ad free experience by logging in. Not a member yet? Register.
Results 1 to 2 of 2
  1. #1
    New to the CF scene
    Join Date
    Aug 2010
    Thanked 0 Times in 0 Posts

    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
    Supreme Master coder! Philip M's Avatar
    Join Date
    Jun 2002
    London, England
    Thanked 2,704 Times in 2,680 Posts
    See forum rule 1.5 No homework assignments - Do not post your entire homework assignment and request that other members do it for you. This is considered cheating, and your thread may even be used by your school to prove your guilt. Now, you may ask for advice or help on a specific aspect of your assignment that you're having trouble with. Use common sense as far as what's acceptable in terms of soliciting help with homework assignments.

    In short, you must make an efort to write the necessary code yourself, and then if you are still having problems I am sure someone will corrcet/improve it for you.


Posting Permissions

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