Hi guys,
We are meant to create a method called sortTheArray (self explanatory)...
We are not allowed to use java.util.Arrays according to the specification even though its much easier... We have to recreate simple version of vector class hence need to write our own sorting method..
this is what I have so far...
I get the following error with the if statement..
The operator
We are meant to create a method called sortTheArray (self explanatory)...
We are not allowed to use java.util.Arrays according to the specification even though its much easier... We have to recreate simple version of vector class hence need to write our own sorting method..
this is what I have so far...
public void sortTheArray()
{
//create a new array for holding the values of the old array.
for (int i = 0; i < itemArray.length; i++)
{
for (int j = i + 1; j < itemArray.length; j++)
{
[b]if (itemArray[i] > itemArray[j])[/b]
{
Item tempValue = itemArray[j];
itemArray[j] = itemArray[i];
itemArray[i] = tempValue;
}
}
}
I get the following error with the if statement..
The operator
>is undefined for the argument type(s) unisa.progfund.item, unisa.progfund.item :S