Question: Write a Java program extending a class. Assume that the following class structure is available: abstract class IntArray{ private int[] data; public IntArray(){ //constructors }
- Write a Java program extending a class. Assume that the following class structure is available:
abstract class IntArray{
private int[] data;
public IntArray(){ //constructors
}
public abstract boolean outOfOrder(int one, int two);
public void sort(){
int i, j, temp;
for(i=0;i for(j=i+1;j if (outOfOrder(data[i], data[j]) ){ temp = data[i]; data[i] = data[j]; data[j] = temp; } } } You should write an extended class IncArray in which the increasing order is the right order; i.e. outOfOrder(3, 5) is false; outOfOrder(5, 3) is true. Also override the toString method so you can convert the array on terminal.
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
