hallo ihr experten 
habe mal wieder ein problem, hoffe ihr könnt mir helfen. möchte ein zufallspolynom erstellen und dass dann mit bubblesort sortieren. zufallspolynom seperat funktioniert, nur beim sortieren kommt eine fehlermeldung...
die fehlermeldung sieht folgendermaßen aus:
bin ratlos, das muss doch irgendwie gehen... lg
habe mal wieder ein problem, hoffe ihr könnt mir helfen. möchte ein zufallspolynom erstellen und dass dann mit bubblesort sortieren. zufallspolynom seperat funktioniert, nur beim sortieren kommt eine fehlermeldung...
Code:
import HUMath.Algebra.*;
import java.lang.*;
import java.io.*;
public class poly {
static DX p, anf, polynom;
static double sortiert[];
public static DX zuf()
{
p = new DX();
anf = p;
p.co = Math.random()*100.0;
p.ex = (int)(Math.random()*10);
p.next = new DX();
p = p.next; //next= nächster Summand
p.co = Math.random()*100.0;
p.ex = (int)(Math.random()*10);
p.next = new DX();
p = p.next;
p.co = Math.random()*100.0;
p.ex = (int)(Math.random()*10);
return anf;
}
public static int[] bubbleSort(int[] sammlung)
{
int temp;
for (int i = 0; i < sammlung.length; i++)
for (int j = 0; j < sammlung.length-1; j++)
if (sammlung[j+1] < (sammlung[j]))
{ // vergleichen
temp = sammlung[j+1]; // austauschen
sammlung[j+1] = sammlung[j];
sammlung[j] = temp;
}
}
public static void main(String[] arg)
{
DX p = zuf(); //DX=Konstrukteur
DX.write(p);
polynom=zuf();
DX.write(polynom);
sortiert = bubbleSort(polynom); //oder
DX.write(bubbleSort(polynom));
}
}
die fehlermeldung sieht folgendermaßen aus:
Code:
poly.java: 58,60: bubbleSort(int[n]) in poly cannot be applied to (HUMath.Algebra.DX)
bin ratlos, das muss doch irgendwie gehen... lg