好的,所以我写了一个程序,让我可以确定两个圆圈是否重叠。
除了一个问题,我的程序无任何问题:程序将不接受我为两个中心点之间的距离编写的代码。我可以弄清楚if / else的逻辑来告诉用户,随后的距离值会发生什么,但是我想知道现在出了什么问题。 Eclipse,我正在编码的程序,告诉我,距离应该被解析成一个数组,但是我已经告诉过你这是一个int。
这是我的代码:
package circles;
import java.util.Scanner;
public class MathCircles {
// variable for the distance between the circles' centers
public static int distance;
// variable for the lengths of the radii combined
public static int radii;
public static void main(String[] args) {
// Get the x-value of the center of circle one
System.out.println("What is the x-coordinate for the center of circle one?");
Scanner keyboard = new Scanner(System.in);
int x1 = keyboard.nextInt();
//Get the y-value of the center of circle one
System.out.