Results 1 to 2 of 2
Thread: overlap radius... help me..
- 08-21-2010, 08:04 PM #1Member
- Join Date
- Aug 2010
- Rep Power
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
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!
- By tepong in forum New To JavaReplies: 1Last Post: 08-21-2010, 06:38 PM
- By Krooger in forum AWT / SwingReplies: 3Last Post: 06-08-2009, 06:12 PM
- By megironi in forum New To JavaReplies: 1Last Post: 03-27-2009, 07:09 AM