disjolat I iF statement-Coosle 13) conplete the following code to test whether t
ID: 3586209 • Letter: D
Question
disjolat I iF statement-Coosle 13) conplete the following code to test whether two cireles, each having a user defined redius and a fixed center potnt lying along the sane hortzontal line, are disjoint, over lapping, or nutualty contatned. Let's say that when circtes touch at a stngte point, we consider then to be overlapping or nutually contalred, as ts approprtate. Look at the switch statenent to declde Sow to set the result vartable. Lnport java.util.scanser ; pubLte class Circteöverlap publte static vold natn(stringt args) ror (tat center2-26; center.Explanation / Answer
float distanceBetweenCenters = Math.sqrt( Math.pow( (xcenter1-xcenter2),2 ) + Math.pow( (ycenter1 - ycenter2),2 ) ); //calculate distance between centers of both circles. formula = sqrt((x1 - x2) ^ 2 + (y1 - y2) ^ 2).
if( distanceBetweenCenters > (r1+r2) )
{
result = 1;
} else if( distanceBetweenCenters == (r1+r2))
{
result = 2;
}else {
result =3;
}
Related Questions
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.