test implementation of classes with autoboxing

This commit is contained in:
2020-05-30 10:33:12 -05:00
parent 10662f96d9
commit fbd13aaac3
3 changed files with 85 additions and 4 deletions

View File

@@ -2,4 +2,23 @@ package Sorting;
public class BubbleSorter extends Sorter{
//a class to sort arrays of numbers using bubble sort
public BubbleSorter(String filename){
super(filename);
}
void sort(){
boolean usedSwap;
do{
usedSwap=false;
for(int i=0;i<numbers.length-1;i++){
if(compare(numbers[i],numbers[i+1])>0){
swap(numbers[i],numbers[i+1]);
usedSwap=true;
}
}
}while(usedSwap);
}
}