i need make this program run..anyone can help me?

import java.util.*;
import java.awt.*;
import java.net.URL;
class Prim extends CompleteEuclideanGraph {
   private ArrayList remainingPoints; //points not on MST
   private ArrayList completedPoints; //points on MST
   private Point[] chosen;            //array of chosen points for each step
   private int bpoint = -1;           //pointer to the current step so can step back
   private Point bestp;               //point closest to MST
   private double cost = 0.0;         //distance of the MST
   public Prim() {
      super("Prim");
      legend.Init();
      legend.AddEdge("MST Path", Color.black);
      legend.AddPoint("Point", Color.blue);
      legend.Finish();
   }
   public void setInput(URL url, int N, double density) {
      //Call CompleteEuclideanGraph setInput
      super.setInput(url, N, density);
      //initialize important variables (variables that paintComponent might need)
      bpoint = -1;
      completedPoints = null;
      cost = 0.0;
   }
   public double getCost() {
      return cost;
   }
 

  /*************************************************
   *  Run one step of Prim's algorithm.            *
   *************************************************/
   public void step() {
      //no input yet or algorithm is over
      if (points == null || currentStep == N)
         return;
      //Circle visualization
      if(myVisuals.circles) {
  Vstep();
  return;
      }
      // initialization before first step
      if (currentStep == 0) {
         remainingPoints = new ArrayList(this.points);
         completedPoints = new ArrayList();
  chosen = new Point[remainingPoints.size()];
         //initialize points
         Iterator it = remainingPoints.iterator();
         Point p = null;
         while (it.hasNext()) {
            p = (Point) it.next();
            p.cost = Double.MAX_VALUE;   //the distance to the closest point on MST
            p.ptr = null;                //pointer to nearest point
         }
         //initial point in MST
         if (p != null) {
            p.cost = 0.0;
            p.ptr = p;
         }
      }
      //find the closest point to MST out of remaining points
      Point p = null;
      bestp = null;
      double bestdist = Double.MAX_VALUE;
      Iterator it = remainingPoints.iterator();
      while (it.hasNext()) {
         p = (Point) it.next();
         if (p.cost < bestdist) {
     bestdist = p.cost;
            bestp = p;
         }
      }
      remainingPoints.remove(bestp);
      completedPoints.add(bestp);
      cost += Point.distance(bestp, bestp.ptr);  //update distance
      chosen[++bpoint] = bestp;                  //chosen point to add to tree
      updateDistanceToTree(bestp);               //updates distance MST for the
                                                 //remaining points
      currentStep++;
   }
   public void Vstep() {
      myVisuals.InitVstep();
      // initialization before first step
      if (currentStep == 0 && myVisuals.firstVstep()) {
         remainingPoints = new ArrayList(this.points);
         completedPoints = new ArrayList();
  chosen = new Point[remainingPoints.size()];
         Iterator it = remainingPoints.iterator();
         Point p = null;
         while (it.hasNext()) {
            p = (Point) it.next();
            p.cost = Double.MAX_VALUE;
            p.ptr = null;
         }
         if (p != null) {
            p.cost = 0.0;
            p.ptr = p;
         }
      }
      // normal iteration, figure out the next point
      if(myVisuals.firstVstep()) {
         Point p = null;
         bestp = null;
         double bestdist = Double.MAX_VALUE;
         Iterator it = remainingPoints.iterator();
         while (it.hasNext()) {
     p = (Point) it.next();
            if (p.cost < bestdist) {
        bestdist = p.cost;
            bestp = p;
            }
         }
      }
      //add best point to the MST
      if(myVisuals.InitFinalVisual()) {
         remainingPoints.remove(bestp);
         completedPoints.add(bestp);
  cost += Point.distance(bestp, bestp.ptr);
  chosen[++bpoint] = bestp;
         updateDistanceToTree(bestp);
      }
      //visual steps are done, increment current step
      if(myVisuals.VstepsDone()) currentStep++;
   }
   public void stepback() {
      //reset visual steps
      myVisuals.resetVsteps();
      //have run a step of the animation
      if(bpoint >= 0) {
         //remove previously added point from MST
  completedPoints.remove(chosen[bpoint]);
  remainingPoints.add(chosen[bpoint]);
         //update cost
  cost -= Point.distance(chosen[bpoint], chosen[bpoint].ptr);
         //change back the nearest points for the remaining points
  FixAltered(chosen[bpoint]);
  --bpoint;
  --currentStep;
      }
   }
   public void paintComponent(Graphics g) {
      //Call CompleteEuclideanGraph's paintComponent
      super.paintComponent(g);
      Graphics2D g2 = (Graphics2D) g;
      //set thickness of outlines of painted objects
      g2.setStroke(strokeSize);
      //points in the tree
      if (completedPoints != null) {
         Point p;
   //draw circles
  if (myVisuals.circles) {
     Iterator it = completedPoints.iterator();
            //size of the circles
     double size = Point.ScaleDistance(bestp, bestp.ptr, rect.width, rect.height);
            //draw circles around all the the remaining points
     while (it.hasNext()) {
        p = (Point) it.next();
        if(p != bestp) myVisuals.drawCircle(g2, Color.red, rect, p, size);
     }
            //draw the circle around the newly added point green
     if(myVisuals.finalVisual()) {
        myVisuals.drawCircle(g2, Color.green, rect, bestp.ptr, size);
     }
  }
         //draw tree path
  Iterator it = completedPoints.iterator();
         while (it.hasNext()) {
            p = (Point) it.next();
            Point.drawPath(p, p.ptr, g2, Color.black, rect);
         }
      }
      //draw all the points
      if (points != null) {
         Point p;
         Iterator it = points.iterator();
         while (it.hasNext()) {
            p = (Point) it.next();
            Point.drawVertex(p, g2, Color.blue, 2, rect);
         }
      }
   }
   //for each remaining point, update the closest distance to the tree
   void updateDistanceToTree(Point p) {
      Point q;
      double dist;
      Iterator it = remainingPoints.iterator();
      while (it.hasNext()) {
         q = (Point) it.next();
         dist = Point.distance(p, q);
         if (dist < q.cost) {
            q.cost = dist;
            q.ptr = p;
         }
      }
   }
   /**
    * Fix the remaining points ptr to the nearest point on the tree
    * when stepback is called, only points remaining points who's closest
    * point to the tree is the point just removed
    */
   void FixAltered(Point p) {
      Point q, t;
      Iterator it = remainingPoints.iterator();
      while (it.hasNext()) {
  q = (Point) it.next();
  if(q.ptr == p) {
     q.cost = Double.MAX_VALUE;
     double dist;
     Iterator newit = completedPoints.iterator();
     while (newit.hasNext()) {
         t = (Point) newit.next();
  dist = Point.distance(q, t);
  if(dist < q.cost) {
    q.cost = dist;
    q.ptr = t;
  }
     }
  }
      }
   }
}

Usually you would save in a file named Prim.java then execute:
> javac Prim.java
If this gives any compilation errors you'll sove them and do again. Then run it using:
> java Prim

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.