//ESTE MÉTODO RECORRE LA LISTA DE JUEGOS DE UN USUARIO Y SUMA LOS JUEGOS GANADOS Y LO DEVUELVE COMO INT public int obtenerJuegosGanados(ListaDoble lista) { int contador = 0; if (lista != null) { NodoLista aux = lista.inicio; while (aux != null) { if (aux.gano) { contador++; } aux = aux.siguiente; } } return(contador); }
//Obtiene el porcentaje de unidades destruidas de una lista public int obtenerPorcentajeUnidadesDestruidas(ListaDoble lista) { int porcentaje = 0; int contador = 0; if (lista != null) { NodoLista aux = lista.inicio; while (aux != null) { porcentaje += (aux.unidadesDestruidas * 100) / aux.unidadesDesplegadas; contador++; aux = aux.siguiente; } } if (contador != 0) { return(porcentaje / contador); } else { return(0); } }