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 }

  1. 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.

  1. Write an application part to test your classes.

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!