Implementing a class in a method
<p>I need to revise a previously written code with a class I just wrote. I don't know how to go about doing this. Can someone please help?</p>

<p>My Program:</p>

<pre><code>  import java.util.Scanner;
  import java.util.Arrays;

public class ModifiedLab7
{
public static void main(String[] args)
{
    Scanner input = new Scanner(System.in);

    System.out.print("How many points? ");
    int n = input.nextInt();

    double[][] points = new double[n][2];
    for(int i = 0; i &lt; n; i++)
    {
        System.out.print("Enter the (x, y) coordintes of point " + (i+1) + ": ");
        points[i][0] = input.nextDouble();
        points[i][1] = input.nextDouble();
    }

    double[][] distances = new double[n][n];
    for(int i = 0; i &lt; n; i++)
        for(int j = 0; j &lt; n; j++)
            distances[i][j] = distance(points[i], points[j]);

    double[] averages = new double[n];
    for(int i = 0; i &lt; n; i++)
        averages[i] = average( distances[i] );

    int min = minimum_location( averages );

    System.out.printf("The smallest average is averages[%d] = %f\n", min, averages[min]);

}

public static double distance( double[] p1, double[] p2)
{
    return Math.sqrt( (p1[0]-p2[0])*(p1[0]-p2[0]) + (p1[1]-p2[1])*(p1[1]-p2[1]));
}

public static double average( double[] x )
{
    double sum = 0;
    for(int i = 0; i &lt; x.length; i++)
        sum += x[i];

    return (x.length &gt; 0)? sum/x.length : 0.0;
}

public static int minimum_location( double[] x )
{
    int min = 0;
    for(int i = 1; i &lt; x.length; i++)
        if( x[i] &lt; x[min] )
            min = i;

    return min;
}
}
</code></pre>

<p>My Class:</p>

<pre><code>class MyPoint
{
//Declare x and y variables
private double X;
private double Y;

//Create MyPoint constructor at point (0,0)
public MyPoint()
{
}

//Create MyPoint constructor with specific coordinates
public MyPoint(double X, double Y)
{
    //Declare x and y variables with specific coordinates
    this.X = X;
    this.Y = Y;
}

//Create distance method from point to another of MyPoint type
public double Distance(MyPoint SecondPoint)
{
    return Distance(this, SecondPoint);
}

//Create distance method from point to another point with specific coordinates
public static double Distance(MyPoint PointOne, MyPoint PointTwo)
{
    return Math.sqrt((PointOne.X - PointTwo.X) * (PointOne.X - PointTwo.X) + (PointOne.Y - PointTwo.Y) * (PointOne.Y - PointTwo.Y));
}

//Create get x method
public double GetX()
{
    return X;
}

//Create get y method
public double GetY()
{
    return Y;
}
}
</code></pre>

<p>I tested my class already and I know it works. </p>
