Question: Compute the intersection between a line and circle ADTs Create a Circle ADT with fields for the center and radius of the circle Create a

Compute the intersection between a line and circle

ADTs

Create a Circle ADT with fields for the center and radius of the circle

Create a Line ADT with fields for the slope and y-intercept of the line

Functions

getCircle: Asks the user to enter the center and radius of a circle. Returns a Circle ADT.

getLine: Asks the use to enter the slope and y-intercept of a line. Returns a Line ADT.

check: A void function that takes as input a Circle and Line ADT. Prints out the intersection of the line and circle. If no intersection exist pints out "no intersections"

Main

Calls the functions getCirlce, getLine, and check.

Here are three sample input and output sets to test your code

Enter the center point and radius: 1 2 5

Enter the line slope and yint: 2 -1

The Intersection is (-0.827106, -2.65421) and (3.62711, 6.25421)

Enter the center point and radius: 1 2 5

Enter the line slope and yint: -2 -10

There is no intersection.

Enter the center point and radius: 1 2 5

Enter the line slope and yint: 1 5.9054

The Intersection is (-3.99912, 1.90628) and (1.09372, 6.99912)

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!