Commit 4ac1b53b authored by AARON FRANCO FERNANDEZ's avatar AARON FRANCO FERNANDEZ
Browse files

Upload New File

parent 2cbd4e88
import java.io.File;
import java.io.FileNotFoundException;
import java.util.Scanner;
import org.jfree.chart.ChartFactory;
import org.jfree.chart.ChartFrame;
import org.jfree.chart.JFreeChart;
import org.jfree.chart.plot.PlotOrientation;
import javax.swing.JFrame;
import org.jfree.chart.ChartPanel;
import org.jfree.data.category.DefaultCategoryDataset;
import org.jfree.data.general.DefaultPieDataset;
public class WordCount {
public static void main(String[] args){
Scanner lector;
int realmadrid = 0;
int atleti = 0;
int getafe = 0;
int rayo = 0;
int barsa = 0;
int mallorca = 0;
int courtois = 0;
int vinicius = 0;
int bale = 0;
int militao = 0;
int alaba = 0;
int mendy = 0;
int nacho = 0;
int kroos = 0;
int modric = 0;
int casemiro = 0;
int valverde = 0;
int benzema = 0;
int hazard = 0;
int asensio = 0;
int rodrygo = 0;
int ancelotti = 0;
int xavi = 0;
int riqui = 0;
int araujo = 0;
int pique = 0;
int pedri = 0;
int ansu = 0;
int gavi = 0;
int messi = 0;
int morata = 0;
int dembele = 0;
int ferran = 0;
int kubo = 0;
int jong = 0;
int cholo = 0;
int suarez = 0;
int koke = 0;
int oblak = 0;
int gimenez = 0;
int griezmann = 0;
int llorente = 0;
int carrasco = 0;
int felipe = 0;
int joao = 0;
int falcao = 0;
int stegen = 0;
int correa = 0;
int pol = 0;
try {
lector = new Scanner(new File("C:\\Users\\Aaron\\eclipse-workspace\\FormulaUno\\Despues_del_Atleti.txt"));
while(lector.hasNext()) {
switch(lector.next().toLowerCase()) {
case "real":
realmadrid++;
break;
case "getafe":
getafe++;
break;
case "atleti":
atleti++;
break;
case "barsa":
barsa++;
break;
case "rayo":
rayo++;
break;
case "courtois":
courtois++;
break;
case "vinicius":
vinicius++;
break;
case "bale":
bale++;
break;
case "militao":
militao++;
break;
case "alaba":
alaba++;
break;
case "mendy":
mendy++;
break;
case "nacho":
nacho++;
break;
case "kroos":
kroos++;
break;
case "casemiro":
casemiro++;
break;
case "modric":
modric++;
break;
case "valverde":
valverde++;
break;
case "benzema":
benzema++;
break;
case "hazard":
hazard++;
break;
case "asensio":
asensio++;
break;
case "rodrygo":
rodrygo++;
break;
case "ancelotti":
ancelotti++;
break;
case "xavi":
xavi++;
break;
case "riqui":
riqui++;
break;
case "araujo":
araujo++;
break;
case "pique":
pique++;
break;
case "pedri":
pedri++;
break;
case "ansu":
ansu++;
break;
case "gavi":
gavi++;
break;
case "messi":
messi++;
break;
case "morata":
morata++;
break;
case "dembele":
dembele++;
break;
case "ferran":
ferran++;
break;
case "kubo":
kubo++;
break;
case "jong":
jong++;
break;
case "cholo":
cholo++;
break;
case "suarez":
suarez++;
break;
case "koke":
koke++;
break;
case "oblak":
oblak++;
break;
case "gimenez":
gimenez++;
break;
case "griezmann":
griezmann++;
break;
case "llorente":
llorente++;
break;
case "carrasco":
carrasco++;
break;
case "felipe":
felipe++;
break;
case "joao":
joao++;
break;
case "falcao":
falcao++;
break;
case "stegen":
stegen++;
break;
case "paul":
pol++;
break;
case "correa":
correa++;
break;
default:
break;
}
}
} catch (FileNotFoundException e) {
e.printStackTrace();
}
//En el de madrid 18, los otros 15 variables
System.out.println("\nInteracciones sobre el Real Madrid: " + (realmadrid + getafe + courtois + vinicius + bale + militao + alaba + mendy +
nacho + kroos + modric + casemiro + valverde + benzema + hazard + asensio + rodrygo + ancelotti));
System.out.println("\nInteracciones sobre el Barsa: " + (barsa + mallorca + xavi + riqui + araujo + pique + pedri + ansu + gavi + morata +
dembele + ferran + kubo + jong + stegen));
System.out.println("\nInteracciones sobre el Atleti: " + (atleti + rayo + cholo + suarez + koke + oblak + gimenez + griezmann + llorente +
carrasco + felipe + joao + falcao + pol + correa));
//DIAGRAMA DE SECTORES MADRID
DefaultPieDataset dataset2_0 = new DefaultPieDataset();
dataset2_0.setValue("Real madrid", realmadrid);
dataset2_0.setValue("Getafe", getafe);
JFreeChart chart2_0 = ChartFactory.createPieChart("Real Madrid vs Getafe (Despues del Atleti)", dataset2_0, true, true, false);
ChartFrame frame2_0 = new ChartFrame("Grafica Real Madrid vs Getafe", chart2_0);
frame2_0.pack();
frame2_0.setSize(800, 700);
frame2_0.setVisible(true);
//DIAGRAMA DE SECTORES barsa
DefaultPieDataset dataset2_1 = new DefaultPieDataset();
dataset2_1.setValue("Barsa", barsa);
dataset2_1.setValue("Mallorca", mallorca);
JFreeChart chart2_1 = ChartFactory.createPieChart("Barsa vs Mallorca (Despues del Atleti)", dataset2_1, true, true, false);
ChartFrame frame2_1 = new ChartFrame("Grafica Barsa vs Mallorca", chart2_1);
frame2_1.pack();
frame2_1.setSize(800, 700);
frame2_1.setVisible(true);
//DIAGRAMA DE SECTORES atleti
DefaultPieDataset dataset2_2 = new DefaultPieDataset();
dataset2_2.setValue("Atleti", atleti);
dataset2_2.setValue("Rayo", rayo);
JFreeChart chart2_2 = ChartFactory.createPieChart("Atleti vs Rayo (Despues del Atleti)", dataset2_2, true, true, false);
ChartFrame frame2_2 = new ChartFrame("Grafica Atleti vs Rayo", chart2_2);
frame2_2.pack();
frame2_2.setSize(800, 700);
frame2_2.setVisible(true);
//DIAGRAMA DE BARRAS barsa
DefaultCategoryDataset dataset1_0 = new DefaultCategoryDataset();
dataset1_0.setValue(courtois, "courtois", "courtois");
dataset1_0.setValue(vinicius, "vinicius", "vinicius");
dataset1_0.setValue(bale, "bale", "bale");
dataset1_0.setValue(militao, "militao", "militao");
dataset1_0.setValue(alaba, "alaba", "alaba");
dataset1_0.setValue(mendy, "mendy", "mendy");
dataset1_0.setValue(nacho, "nacho", "nacho");
dataset1_0.setValue(kroos, "kroos", "kroos");
dataset1_0.setValue(modric, "modric", "modric");
dataset1_0.setValue(casemiro, "casemiro", "casemiro");
dataset1_0.setValue(valverde, "valverde", "valverde");
dataset1_0.setValue(benzema, "benzema", "benzema");
dataset1_0.setValue(hazard, "hazard", "hazard");
dataset1_0.setValue(asensio, "asensio", "asensio");
dataset1_0.setValue(rodrygo, "rodrygo", "rodrygo");
dataset1_0.setValue(ancelotti, "ancelotti", "ancelotti");
JFreeChart chart1_0 = ChartFactory.createBarChart3D("Jugadores Real Madrid (Despues del Atleti)","Jugadores", "Veces nombrados",
dataset1_0, PlotOrientation.HORIZONTAL, true, false, false);
ChartFrame frame1_0 = new ChartFrame("Diagrama de Barras juagdores Real madrid", chart1_0);
frame1_0.pack();
frame1_0.setSize(800, 700);
frame1_0.setVisible(true);
//DIAGRAMA DE BARRAS barsa
DefaultCategoryDataset dataset1_1 = new DefaultCategoryDataset();
dataset1_1.setValue(xavi, "xavi", "xavi");
dataset1_1.setValue(riqui, "riqui", "riqui");
dataset1_1.setValue(araujo, "araujo", "araujo");
dataset1_1.setValue(pique, "pique", "pique");
dataset1_1.setValue(pedri, "pedri", "pedri");
dataset1_1.setValue(ansu, "ansu", "ansu");
dataset1_1.setValue(gavi, "gavi", "gavi");
dataset1_1.setValue(morata, "morata", "morata");
dataset1_1.setValue(dembele, "dembele", "dembele");
dataset1_1.setValue(ferran, "ferran", "ferran");
dataset1_1.setValue(kubo, "kubo", "kubo");
dataset1_1.setValue(jong, "jong", "jong");
dataset1_1.setValue(stegen, "stegen", "stegen");
JFreeChart chart1_1 = ChartFactory.createBarChart3D("Jugadores Barsa (Despues del Atleti)","Jugadores", "Veces nombrados",
dataset1_1, PlotOrientation.HORIZONTAL, true, false, false);
ChartFrame frame1_1 = new ChartFrame("Diagrama de Barras juagdores Barsa", chart1_1);
frame1_1.pack();
frame1_1.setSize(800, 700);
frame1_1.setVisible(true);
//DIAGRAMA DE BARRAS atleti
DefaultCategoryDataset dataset1_2 = new DefaultCategoryDataset();
dataset1_2.setValue(cholo, "cholo", "cholo");
dataset1_2.setValue(suarez, "suarez", "suarez");
dataset1_2.setValue(koke, "koke", "koke");
dataset1_2.setValue(oblak, "oblak", "oblak");
dataset1_2.setValue(gimenez, "gimenez", "gimenez");
dataset1_2.setValue(griezmann, "griezmann", "griezmann");
dataset1_2.setValue(llorente, "llorente", "llorente");
dataset1_2.setValue(carrasco, "carrasco", "carrasco");
dataset1_2.setValue(felipe, "felipe", "felipe");
dataset1_2.setValue(joao, "joao", "joao");
dataset1_2.setValue(falcao, "falcao", "falcao");
dataset1_2.setValue(pol, "paul", "paul");
dataset1_2.setValue(correa, "correa", "correa");
JFreeChart chart1_2 = ChartFactory.createBarChart3D("Jugadores Atleti (Despues del Atleti)","Jugadores", "Veces nombrados",
dataset1_2, PlotOrientation.HORIZONTAL, true, false, false);
ChartFrame frame1_2 = new ChartFrame("Diagrama de Barras juagdores Atleti", chart1_2);
frame1_2.pack();
frame1_2.setSize(800, 700);
frame1_2.setVisible(true);
}
}
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment