import java.util.ArrayList;
import java.util.Collections;
import java.lang.Object;
import java.io.File;
import java.io.FileNotFoundException;
import java.util.Scanner;
public class Bracket_Creator{
public static void main(String[] args) throws FileNotFoundException
{
String first_name = "";
String last_name = "";
String school = "";
int weight = 0;
int confer_win = 0;
int confer_loss = 0;
int overall_wins = 0;
int overall_loss = 0;
ArrayList<Wrestler> list = new ArrayList<Wrestler>();
int i = 0;
boolean flag = true;
Scanner scanner = new Scanner(new File("wrestlers.csv"));
scanner.useDelimiter(",");
while(scanner.hasNext()){
first_name = scanner.next();
last_name = scanner.next();
school = scanner.next();
weight = scanner.nextInt();
confer_win = scanner.nextInt();
confer_loss = scanner.nextInt();
overall_wins = scanner.nextInt();
overall_loss = scanner.nextInt();
list.add(new Wrestler(first_name,last_name,school,weight,
confer_win,confer_loss,overall_wins,overall_loss));
System.out.println((list.get(i).get_first_name()));
i++;
}
scanner.close();
for (i = 0; i < list.size(); i++){
(list.get(i)).determine_conf_percentage((list.get(i)).get_confer_wins(), (list.get(i)).get_confer_losses());
(list.get(i)).determine_overall_percentage((list.get(i)).get_overall_wins(), (list.get(i)).get_overall_losses());
}
while ( flag )
{
flag= false;
for( i=0; i < list.size() -1; i++ )
{
if ((list.get(i)).get_confer_percentage() < (list.get(i+1)).get_confer_percentage() )
{
Collections.swap(list, i, i+1);
flag = true;
}
}
}
for (i = 0; i< list.size(); i++){
(list.get(i)).set_rank(i + 1);
}
for (i = 0; i< list.size(); i++){
System.out.println((list.get(i)).get_first_name());
}
System.out.println("");
int j = 1;
for (i = 0; i< (list.size()/2); i++){
if (i == 0) {
System.out.println((list.get(i)).get_first_name());
System.out.println((list.get(list.size()-j)).get_first_name());
System.out.println();
j++;
}
else{
System.out.println((list.get(i)).get_first_name());
System.out.println((list.get(list.size()-j)).get_first_name());
System.out.println();
j++;
}
}
}
}