Zitat:
Original geschrieben von Max Mustermann
Hallo liebes Forum!
Ich höffe ihr könnt mir helfen, denn ich muss für folgenden Klasse für Komplexe Zahlen in Polarform: k=r*(cos(phi)+i*sin(phi)) die Methode mult in eine Instanzmethode umwandeln welche zu einer komplexen Zahl eine andere komplexe Zahl hinzumultipliziert.
public class Complex {
double r, phi;
public Complex (double r, double phi) {
this.r=r; this.phi=phi;
}
static void mult (Complex c1, Complex c2) {
c1.r=c1.r*c2.r;
c1.phi=c1.phi+c2.phi;
}
vielen Dank!!
|
probier mal folgendes:
public void mult (Complex c2){
this.r=*c2.r;
this.phi=+c2.r;
}
bin mir aber nicht ganz sicher da ich selber erst vor kurzem mit java angefangen habe.
unter
www.javabuch.de kannst dir ein javabuch als html runterladen, das normalerweise € 60 .- kostet und auch als nachschlagewerk sehr brauchbar ist.