以下の toString メソッドで使用する適格な ForBonus() の出力を取得するにはどうすればよいですか。「this.isBonus」をプレースホルダーとして使用しましたが、isBonus はクラスの変数ではないため機能しません。
public String eligibleForBonus(double salary){
String isBonus;
if (salary >= 40000) {
isBonus = "is";
}
else {
isBonus = "is not";
}
return isBonus;
}
}
@Override
public String toString() {
return this.forename + " " + this.surname + " (" + this.id + "): " + this.companyPosition + " at " + this.salary + " and " + this.isBonus + " eligible for bonus.";
}