Question: 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

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, as shown in
the below figure.
(Hint: circle2 is inside circle1 if the distance between the two centers + r2<= r1 and circle2
overlaps circle1 if the distance between the two centers <= r1+ r2.
Test your program to cover all cases.)
Sample three runs:
Enter circle1's center x coordinate: 0.5
Enter circle1's center y-coordinates: 5.1
Enter circle1's radius: 13
Enter circle2's center x coordinate: 1.0
Enter circle2's center y-coordinates: 1.7
Enter circle2's radius: 4.5
circle2 is inside circle1
Enter circle1's center x coordinate: 4.4
Enter circle1's center y-coordinates: 5.7
Enter circle1's radius: 5.5
Enter circle2's center x coordinate: 6.7
Enter circle2's center y-coordinates: 3.5
Enter circle2's radius: 3
circle2 overlaps circle1
Enter circle1's center x coordinate: 4.4
Enter circle1's center y-coordinates: 5.5
Enter circle1's radius: 1
Enter circle2's center x coordinate: 5.5
Enter circle2's center y-coordinates: 7.2
Enter circle2's radius: 1
circle2 does not overlap circle1

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!