Guten Abend, beim Kompilieren kommt immer der Fehler
incompatible types: possible lossy conversion from doubt to int.
[CODE lang="java" highlight="12"]public static void analyze(Resistor resistor) {
ElectronicColorCode ring1 = resistor.bandA();
ElectronicColorCode ring2 = resistor.bandB();
ElectronicColorCode ring3 = resistor.bandC();
int r1 = colorValue(ring1);
int r2 = colorValue(ring2);
int r3 = colorValue(ring3);
int sollWiderstand;
int istWiderstand = resistor.resistance(); // measured resistance
double tolerance = Math.abs((sollWiderstand - istWiderstand)) / sollWiderstand * 100;
ElectronicColorCode ring4 = toleranceCode(tolerance);
resistor.setBandD(ring4);
}[/CODE]
Ich bin echt unsicher in Englisch und beim Nachschauen/Übersetzen stoße ich immer auf englisch-sprachige Seiten.
Ich wäre für Hilfe sehr dankbar
incompatible types: possible lossy conversion from doubt to int.
[CODE lang="java" highlight="12"]public static void analyze(Resistor resistor) {
ElectronicColorCode ring1 = resistor.bandA();
ElectronicColorCode ring2 = resistor.bandB();
ElectronicColorCode ring3 = resistor.bandC();
int r1 = colorValue(ring1);
int r2 = colorValue(ring2);
int r3 = colorValue(ring3);
int sollWiderstand;
int istWiderstand = resistor.resistance(); // measured resistance
double tolerance = Math.abs((sollWiderstand - istWiderstand)) / sollWiderstand * 100;
ElectronicColorCode ring4 = toleranceCode(tolerance);
resistor.setBandD(ring4);
}[/CODE]
Ich bin echt unsicher in Englisch und beim Nachschauen/Übersetzen stoße ich immer auf englisch-sprachige Seiten.
Ich wäre für Hilfe sehr dankbar