Academic Integrity: tutoring, explanations, and feedback — we don’t complete graded work or submit on a student’s behalf.

Please help me what is wrong. It doesn\'t like the compareTo :( please give //no

ID: 642592 • Letter: P

Question

Please help me what is wrong. It doesn't like the compareTo :( please give //notes as too what was wrong so I know for future refrence

___________________________________________________________________

import java.io.*;
import java.util.*;


public class T

{
int position, scan,p=-1;

  
  

void bubbleSort(T[] data)

{

for (position=0; position<=data.length -1; position++)

{

if(p+1==position)
{

for (scan=0; scan <= position -1;scan++)

{

if (data[scan].compareTo(data[scan+1])>0)
{
swap(data,scan,scan+1);
p=position;
}
}
}
else
{
println("List is sorted");
System.exit(0);
}

}

}

}

Explanation / Answer

import java.util.Scanner; class BubbleSort { public static void main(String []args) { int n, c, d, swap; Scanner in = new Scanner(System.in); System.out.println("Input number of integers to sort"); n = in.nextInt(); int array[] = new int[n]; System.out.println("Enter " + n + " integers"); for (c = 0; c