Tenho 3 classes para implementar uma ordenação de uma tabela usando um campo chamado Chave dos registros da tabela.Preciso criar uma classe para implementação utilizando essas tres classes:
ai vai elas:
public class TesteSort5 {
static void Sort5(int x[],int n) {
int i, k, y;
for (k=1;k< n; k++) {
y = x[k];
for (i=k-1; i>=0 && y<x[i]; i–)
x[i+1] = x[i];
x[i+1] = y;
Imprime (x, n);
}
}
static void Imprime (int x[],int n) {
for (int k=0;k< n; k++)
System.out.println( x[k] );
System.out.println();
}
public static void main (String [] args) {
int x[] = { 100, 45, 35, 20, 6 };
Sort5 (x, 5);
}
} //class TesteSort5
public class Tabela {
private static int MAXREG = 1000;
private int numMaxReg;
private Registro T[];
Tabela () {
this(MAXREG);
}
Tabela (int nR) {
numMaxReg = nR;
T = new Registro [numMaxReg];
}
public void setReg (Registro Reg, int pos) {
T[pos] = Reg;
}
public Registro getReg (int pos) {
return T[pos];
}
}
public class Registro {
private int chave;
private String nome;
public void setChave (int num) {
this.chave = num;
}
public void setNome (String nome) {
this.nome = nome;
}
public int getChave () {
return chave;
}
public String getNome () {
return nome;
}
}
preciso implementar as classes TestSort5, Registro, Tabela…
e criar uma outra classe tipo…TesteOrdenacao.java…
alguem pode me ajudar…
grato