Lab 3 - Decisions - CircleOverlap


Lab 3 - Decisions

Complete the following code to test whether two circles, each having a user-defined radius and a fixed center point lying along the same horizontal line, are disjoint, overlapping, or mutually contained. Consider how you would do it manually first.

```java
import java.util.Scanner;

public class CircleOverlap
{
public static void main(String[] args)
{
Scanner in = new Scanner(System.in);
System.out.print("Input the radius of the first circle: ");
double radius1 = in.nextDouble();
double xcenter1 = 0;
double ycenter1 = 0;
System.out.print("Input the radius of the second circle: ");
double radius2 = in.nextDouble();
double xcenter2 = 40;
double ycenter2 = 0;
// Your work goes here
}
}
```
Powered by