Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Write a program that reads in the center coordinates and radii of three circles, A, B and C, and reports the location of a query

Write a program that reads in the center coordinates and radii of three circles, A, B and C, and reports the location of a query point relative to the circles. The location can be one of eight possibilities: contained in A, B and C, contained in A and B, contained in A and C, contained in B and C, contained in A, contained in B, contained in C, not contained in any circles. 1. Prompt and read in the x and y coordinates of the center of circle A; 2. Prompt and read in the radius of circle A; 3. Prompt and read in the x and y coordinates of the center of circle B; 4. Prompt and read in the radius of circle B; 5. Prompt and read in the x and y coordinates of the center of circle C; 6. Prompt and read in the radius of circle C; 7. Prompt and read in the x and y coordinates of the query point; 8. Point (x ; y ) is contained in the circle with center (c x ; c y ) and radius r if: q(x c x )2 + (y c y )2 r : By applying this equation to each circle and the query point, determine which circles contain the query point. Note: The operator ^ is NOT the square operator in C++. To compute (x c x )2 in C++, create a variable to hold x c x and the variable with itself. Same for (y c y )2. 9. Output should be one of the following: Circles A, B, and C contain point (x,y). Circles A and B contain point (x,y). Circles A and C contain point (x,y). Circles B and C contain point (x,y). Circle A contains point (x,y). Circle B contains point (x,y). Circle C contains point (x,y). No circle contains point (x,y). In the output x and y should be replaced by the oating point numbers which are the actual coordinates of x and y . 10. Circle center coordinates, query point coordinates and circle radii are oating point numbers. Use double precision.

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

DNA Databases

Authors: Stefan Kiesbye

1st Edition

0737758910, 978-0737758917

More Books

Students also viewed these Databases questions