i need to call an array called team into a bubble sort that swaaps 3rd 4th ist and 2nd place in order. in the code i will list the code for the out come of the match which is good no errors there but i need to get the bubble sort to swap and print out the results. i keep getting these errors.
public void printArray (Team[] array)this is done in TextPad and this error appears four time
1. illegal start of expression and it points to the p in public.
2. illegal start of expression and points to the v in void.
3. it point to the bracket before team and says ';' expected.
4. it points to the bracket after array and says ';' expected
public void runFinalRound()
{
int count = 1;
current = head;
int c = 0;
System.out.println("\n WELCOME BACK SPECTATORS & FANS \n THE FINAL ROUND IS ABOUT TO BEGIN");
System.out.println("\nTHIRD AND FOURTH PLACE " + count);
System.out.println("" + current.newTeam.teamName + "V.S " +current.link.newTeam.teamName + " " +(count + ran.nextInt(5))+":05pm @ HASLEY CROFORD STADIUM ");
current.newTeam.goalsFor = ran.nextInt(2);
current.link.newTeam.goalsFor = ran.nextInt(2);
System.out.println("\nScore " + current.newTeam.goalsFor +":"+current.link.newTeam.goalsFor);
if(current.newTeam.goalsFor > current.link.newTeam.goalsFor)
{
current.newTeam.points = 10;
current.link.newTeam.points = 8;
System.out.println("3rd :" + current.newTeam.teamName);
System.out.println("4th :" + current.link.newTeam.teamName);
System.out.println("" );
}
else
if(current.newTeam.goalsFor < current.link.newTeam.goalsFor)
{
current.newTeam.points = 8;
current.link.newTeam.points = 10;
System.out.println("3rd :" + current.link.newTeam.teamName);
System.out.println("4th :" + current.newTeam.teamName);
}
else
while(current.newTeam.goalsFor == current.link.newTeam.goalsFor)
{
System.out.println("Match Drawn So This is Extra Time ");
current.newTeam.goalsFor = ran.nextInt(2);
current.link.newTeam.goalsFor = ran.nextInt(2);
System.out.println("Score " + current.newTeam.goalsFor +":"+current.link.newTeam.goalsFor);
if(current.newTeam.goalsFor > current.link.newTeam.goalsFor)
{
current.newTeam.points = 10;
current.link.newTeam.points = 8;
System.out.println("3rd :" + current.newTeam.teamName);
System.out.println("4th :" + current.link.newTeam.teamName);
System.out.println("" );
}
else
if(current.newTeam.goalsFor < current.link.newTeam.goalsFor)
{
current.newTeam.points = 8;
current.link.newTeam.points = 10;
System.out.println("3rd :" + current.link.newTeam.teamName);
System.out.println("4th :" + current.newTeam.teamName);
}
else
if(current.newTeam.goalsFor == current.link.newTeam.goalsFor)
{
System.out.println("\nMATCH STILL DRAWN SO ITS DOWN TO PENALTY SHOOT OUT ");
current.newTeam.goalsFor = ran.nextInt(5);
current.link.newTeam.goalsFor = ran.nextInt(5);
System.out.println("Score " + current.newTeam.goalsFor +":"+current.link.newTeam.goalsFor);
if(current.newTeam.goalsFor > current.link.newTeam.goalsFor)
{
current.newTeam.points = 10;
current.link.newTeam.points = 8;
System.out.println("3rd :" + current.newTeam.teamName);
System.out.println("4th :" + current.link.newTeam.teamName);
System.out.println("" );
}
else
if(current.newTeam.goalsFor < current.link.newTeam.goalsFor)
{
current.newTeam.points = 8;
current.link.newTeam.points = 10;
System.out.println("3rd :" + current.link.newTeam.teamName);
System.out.println("4th :" + current.newTeam.teamName);
}
}
System.out.println("\nFINAL " + count);
System.out.println("" + current.link.link.newTeam.teamName + " V.S " +current.link.link.link.newTeam.teamName + " " +(count + ran.nextInt(5))+":05pm @ HASLEY CROFORD STADIUM ");
current.link.link.newTeam.goalsFor = ran.nextInt(2);
current.link.link.link.newTeam.goalsFor = ran.nextInt(2);
System.out.println("\nScore " + current.link.link.newTeam.goalsFor +":"+current.link.link.link.newTeam.goalsFor);
if(current.link.link.newTeam.goalsFor > current.link.link.link.newTeam.goalsFor)
{
current.link.link.newTeam.points = 20;
current.link.link.link.newTeam.points = 15;
System.out.println("1st :" + current.link.link.newTeam.teamName);
System.out.println("2nd :" + current.link.link.link.newTeam.teamName);
System.out.println("" );
}
else
if(current.link.link.newTeam.goalsFor < current.link.link.link.newTeam.goalsFor)
{
current.link.link.newTeam.points = 15;
current.link.link.link.newTeam.points = 20;
System.out.println("1st :" + current.link.link.link.newTeam.teamName);
System.out.println("2nd :" + current.link.link.newTeam.teamName);
}
else
while(current.link.link.newTeam.goalsFor == current.link.link.link.newTeam.goalsFor)
{
System.out.println("Match Drawn So This is Extra Time ");
current.link.link.newTeam.goalsFor = ran.nextInt(2);
current.link.link.link.newTeam.goalsFor = ran.nextInt(2);
System.out.println("Score " + current.link.link.newTeam.goalsFor +":"+current.link.link.link.newTeam.goalsFor);
if(current.link.link.newTeam.goalsFor > current.link.link.link.newTeam.goalsFor)
{
current.link.link.newTeam.points = 20;
current.link.link.link.newTeam.points = 15;
System.out.println("1st :" + current.link.link.newTeam.teamName);
System.out.println("2nd :" + current.link.link.link.newTeam.teamName);
System.out.println("" );
}
else
if(current.link.link.newTeam.goalsFor < current.link.link.link.newTeam.goalsFor)
{
current.link.link.newTeam.points = 15;
current.link.link.link.newTeam.points = 20;
System.out.println("1st :" + current.link.link.link.newTeam.teamName);
System.out.println("2nd :" + current.link.link.newTeam.teamName);
}
else
if(current.link.link.newTeam.goalsFor == current.link.link.link.newTeam.goalsFor)
{
System.out.println("\nMATCH STILL DRAWN SO ITS DOWN TO PENALTY SHOOT OUT ");
current.link.link.newTeam.goalsFor = ran.nextInt(5);
current.link.link.link.newTeam.goalsFor = ran.nextInt(5);
System.out.println("Score " + current.link.link.newTeam.goalsFor +":"+current.link.link.link.newTeam.goalsFor);
}
if(current.link.link.newTeam.goalsFor > current.link.link.link.newTeam.goalsFor)
{
current.link.link.newTeam.points = 20;
current.link.link.link.newTeam.points = 15;
System.out.println("1st :" + current.link.link.newTeam.teamName);
System.out.println("2nd :" + current.link.link.link.newTeam.teamName);
System.out.println("" );
}
public void bubbleSort(Team array[])
{
int arrayLength = array.length;//get array length
for(int i = 0; i < arrayLength; i++)
{
for(int c = 1; c < (arrayLength - i); c++)
{
//compare and swap
if(array[c - 1].points > array[c].points)
{
Team temp = array[c];
array[c] = array[c - 1];
array[c - 1] = temp;
}//end if
}//end inner for loop
}//end outer for loop
public void printArray(Team[] array)
{
System.out.print("\n Array Data: ");
for(Team i = 0; i < array.length; i++)
{
System.out.print(array[i] + " ");
}//end for loop
}//end method printArray
}//
}