Academic Integrity: tutoring, explanations, and feedback — we don’t complete graded work or submit on a student’s behalf.

Can anyone write a C program for this?? Thanks! Complete the C program below by

ID: 3673480 • Letter: C

Question

Can anyone write a C program for this??

Thanks!

Complete the C program below by adding a function called intersect so that the program will determine if two circles intersect. The first circle has centre (px,py) with radix pr and the second circle has centre (qx,qy) with radix qr. Note that two circles intersect if they share a common area and one circle is not totally within the other. They do not intersect if they have no area in common, one circle is inside the other or they touch at a single point. This skeleton program is available in the Assignment 4 section on the conneX page in a file a4p2start.c. Use your own test data and make sure you check a reasonable number of cases including circles that intersect and do not intersect. Make sure touching circles are handled properly (they do not intersect). #include #include #include Put your function intersect here. int main double px,py,pr,qx,qy,qr; setvbuf(stdout, NULL, _IONBF, 0); while(1) printf("radix 1: "); scanf("%lf",≺); if(pr

Explanation / Answer

Answer:

The intersect function implementation in code exists as below:

int intersect(double p_a,double p_b,double r_p,double q_a,double q_b,double r_q){

   double distance_intersect;
   distance_intersect = calculated(p_a,p_b,q_a,q_b);
  
   if(distance_intersect > (r_q + r_q))
return 0;   
   else if(distance_intersect < abs(r_p - r_q))
return 0;   
   else return 1;
}

double calculated(double p_a,double p_b,double q_a,double q_b){

   double distance_circ;
   distance_circ= sqrt((q_a - p_a)*(q_a - p_a) + (q_b - p_b)*(q_b - p_b));
   return distance_circ;
}

  

Hire Me For All Your Tutoring Needs
Integrity-first tutoring: clear explanations, guidance, and feedback.
Drop an Email at
drjack9650@gmail.com
Chat Now And Get Quote