Hallöchen..
Also für eine Schulaufgabe soll ich die Klasse Vertreter erstellen & anschließend einen Vertreter erstellen in der Startklasse..
Nun möchte ich mit der Methode "berechneProvision"
die Provision eines Vertreters berechnen.
Code:
private double provision;
public double berechneProvision(double provision){
return this.umsatz * this.newProvisionssatz / 100;
}
public double getProvision(){
return this.provision;
}
ich habe einen ausgangs Provisionssatz, der sich allerdings abhängig vom Umsatz ändert. Und den "neuen" Provisionssatz (newProvisionssatz) bestimmte ich so:
Code:
private double newProvisionssatz;
public void ermittleProvisionssatz(double newProvisionssatz)
{
if (this.umsatz >= 20000)
{
newProvisionssatz = Vertretter.provisionssatz + 10;
}
else
{
if (this.umsatz >= 10000) {
newProvisionssatz = Vertretter.provisionssatz + 5;
}
else
{newProvisionssatz = Vertretter.provisionssatz;
}
}
}
Problem: Wenn ich wie oben erwähnt, die Provision so ausrechne:
Code:
return this.umsatz * this.newProvisionssatz / 100;
zeigt er mir 0 an...
Muss ich newProvisionssatz als einen Parameter oder irgendwie so zwischenzeitlich abspeichern?
Lg... ._.