formatting output
This commit is contained in:
@@ -16,8 +16,8 @@ public class AlgorithmTester{
|
||||
static int input;
|
||||
static boolean quit = false;
|
||||
public static void main(String[] args) {
|
||||
System.out.println("SORTING ALGORITHM TESTER\n");
|
||||
while(!quit){
|
||||
System.out.println("\nSORTING ALGORITHM TESTER");
|
||||
System.out.println("Please select an option:");
|
||||
System.out.println("1) Make a file of random numbers");
|
||||
System.out.println("2) Sort a file of random numbers");
|
||||
@@ -62,7 +62,7 @@ public class AlgorithmTester{
|
||||
int min;
|
||||
int max;
|
||||
try{
|
||||
System.out.print("Please enter a file name: ");
|
||||
System.out.print("\nPlease enter a file name: ");
|
||||
filename = sc.next();
|
||||
System.out.println("How many random numbers?");
|
||||
count = sc.nextInt();
|
||||
@@ -83,13 +83,13 @@ public class AlgorithmTester{
|
||||
boolean bubble=false, selection=false, insertion=false;
|
||||
boolean quick=false, counting=false; //radix=false, merge=false;
|
||||
boolean ready=false;
|
||||
boolean print = false;
|
||||
System.out.print("Please enter file name: ");
|
||||
boolean print=false;
|
||||
System.out.print("\nPlease enter file name: ");
|
||||
filename = sc.next();
|
||||
while(!ready){
|
||||
try{
|
||||
System.out.println("Enter the number of the algorithms you wish to use.");
|
||||
System.out.println("Enter 0 to start sorting.");
|
||||
System.out.println("\nEnter the number of an algorithm you wish to use.");
|
||||
System.out.println("Enter the number again to deselect an algorithm.");
|
||||
if(bubble){
|
||||
System.out.print("*");
|
||||
}
|
||||
@@ -110,6 +110,7 @@ public class AlgorithmTester{
|
||||
System.out.print("*");
|
||||
}
|
||||
System.out.println("5) quick sort");
|
||||
System.out.println("Enter 0 to continue when all desired algorithms have been selected.");
|
||||
input = sc.nextInt();
|
||||
switch(input){
|
||||
case 1 -> bubble=!bubble;
|
||||
@@ -125,7 +126,7 @@ public class AlgorithmTester{
|
||||
}
|
||||
}
|
||||
try{
|
||||
System.out.println("Print sorted list?");
|
||||
System.out.println("\nPrint sorted list?");
|
||||
System.out.println("1) Yes");
|
||||
System.out.println("2) No");
|
||||
input = sc.nextInt();
|
||||
@@ -164,10 +165,9 @@ public class AlgorithmTester{
|
||||
System.out.print(i+" ");
|
||||
}
|
||||
}
|
||||
System.out.println("");
|
||||
System.out.println(e.getSortType()+" sort took:");
|
||||
System.out.println("\n"+e.getSortType()+" sort took:");
|
||||
System.out.println(e.getComparisonsUsed()+" comparisons");
|
||||
System.out.println(e.getTimeUsed().toMillis()+" milliseconds\n");
|
||||
System.out.println(e.getTimeUsed().toMillis()+" milliseconds");
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user