Dear all
I have some problem in java
There is one link to help
http://www.seas.gwu.edu/~simhaweb/cs141/hw/a2.html
here is code:
public class Assign2 {
// NOTE: You can change the value to "false" for your estimation,
// but do not remove this variable because we want to set it
// to "true" to test your code.
public static boolean debug = true;
public static int numSteps = 0;
public static int totalDistance = 0;
public static void rendezvous (int numAnts, int M, int[] X, int[] Y, int
[] trapX, int[] trapY, int T)
{// INSERT YOUR CODE HERE
}
static void serial (int numAnts, int M, int[] X, int[] Y, int[] trapX,
int[] trapY, int T)
{
// INSERT YOUR CODE HERE
}
static void parallel (int numAnts, int M, int[] X, int[] Y, int[] trapX,
int[] trapY, int T)
{
// INSERT YOUR CODE HERE
}
public static void main (String[] argv)
{
test1 ();
// INSERT YOUR CODE HERE
}
static void test1 ()
{
int numAnts = 4;
int M = 6;
int[] X = {0, 0, 5, 5 };
int[] Y = {0, 5, 0, 5 };
int[] trapX = {1, 2};
int[] trapY = {2, 1};
int trapDelay = 3;
rendezvous (numAnts, M, X, Y, trapX, trapY, trapDelay);
System.out.println ("numAnts=" + numAnts + " M=" + M);
System.out.println ("Rendezvous: numSteps=" + numSteps + " dist=" +
totalDistance);
serial (numAnts, M, X, Y, trapX, trapY, trapDelay);
System.out.println ("Serial: numSteps=" + numSteps + " dist=" +
totalDistance);
parallel (numAnts, M, X, Y, trapX, trapY, trapDelay);
System.out.println ("Parallel: numSteps=" + numSteps + " dist=" +
totalDistance);
}
}
thanks
i appriciates
Ankur