rendered paste bodypublic class Team {
// instance variables:
private Student[] team;
private int zteam; //Zeiger auf Array team = Anzahl der Teammitglieder
/**
* Constructor for objects of class Team
*/
public Team(int maxTeam) {
// initialise instance variables
team = new Student[maxTeam];
zteam=0;
}//Team
// nicht gefordert: Standard-Team mit Größe 10
public Team(){ this(10); }
public void add(Student neu) {
if(zteam<team.length) {
team[zteam] = neu;
zteam++;
}//if
}//sampleMethod
public int size(){ return zteam;}
public Student get(int index){
if(index>=0 &&index<zteam) return team[index];
// es könnte auch ein Student objekt ohne Inhalte geliefert werden:
// return new Student("","",0);
else return null; //kein Objekt - leere Adresse
}//get
public void remove(int index){
if(index>=0 &&index<zteam) {
for(int i=index;index<zteam-1;index++)team[index] = team[index+1];
zteam--; //Ein Mitglied weniger
}//if
}//remove
public void ausgabe(){
IntIO io = new IntIO();
io.writeln("Unser Team:");
for(int i=0;i<zteam;i++) io.writeln((i+1)+". "+team[i]);
}//ausgabe
private static void sort(String[] a)
{
for(int i = a.length - 1; i > 0; i--)
{
for(int j = 0; j < i; j++)
{
if((a[j].compareTo(a[j + 1])) > 0)
{
String z = a[j];
a[j] = a[j + 1];
a[j + 1] = z;
}
}
}
}
}//Team