I am working on a program and I've got the massage:
error: incompatible types: int cannot be converted to String if(Double.parseDouble(obtenerMedallasEqu(nombre)) > promedio())
when I tried to compilate it. To be honest, I've no idea of how to correct this error.
The methods, that are relevant for this part of the code
public int obtenerMedallasEqu(String nombre){
int i = 0;
int medallas = 0;
while (i<cantEquipos){
if(equipos[i].getNombre().equals(nombre))
medallas = medallas + equipos[i].getOro() + equipos[i].getPlata() + equipos[i].getBronce();
i++;
}
return medallas;
}
public double promedio(){
return (olimpiadasant[0] + olimpiadasant[1] + olimpiadasant[2] + olimpiadasant[3] + olimpiadasant[4])/5;
}
public String medallasOlimp(){
int i = 0;
String resultado = "";
String nombre = "";
while(i < cantEquipos){
if(Double.parseDouble(obtenerMedallasEqu(nombre)) > promedio())
resultado = "La cantidad de medallas obtenidas en Londres del " + i + " equipo es \n mayor que el promedio de medallas obtenidas en las \n 5 olimpiadas precedentes.";
i++;
}
return resultado;
}
Maybe you guys can help me, or at least give me a tip of how to resolve it. Already thank you.