Okay so I'm supposed to be doing an program where the user types in the circles points and the center of the circle...then make a new method for each of the things calculated like distance and area and radius...how do I bring what I did for a method back to method main? This is what I have thus far...
import java.io.*;
import java.util.*;
import static java.lang.Math.*;
public class Circle
{
static Scanner console = new Scanner(System.in);
static final double PI = 3.1416;
public static void main(String[] args)
{
double x1, x2, y1, y2;
System.out.print("Enter the X of the center of a circle.: ");
x1 = console.nextDouble();
System.out.print("Enter the Y of the center of a circle.: ");
y1 = console.nextDouble();
System.out.print("Enter the X of a point on the circle.: ");
x2 = console.nextDouble();
System.out.print("Enter the Y of a point on the circle.: ");
y2 = console.nextDouble();
System.out.print("The distance of the points is: " + distance(z));
}
public static double distance (double x1, double y1, double x2, double y2, double z, double y3, double x3)
{
y3 = (y2 - y1);
y3 = Math.pow(y3, 2);
x3 = (x2 - x1);
x3 = Math.pow(x3, 2);
z = Math.sqrt(y3 + x3);
return z;
}
}