/** * variables for storing data */ private double fixedCompensation; private double variablePercent; private double minSaleTarget; private double acceleratingFactor; private double totalCompensation; private final double minTargetPercent;
public SalespersonCalc(double minSaleTarget) { this.fixedCompensation = 12000; this.variablePercent = 0.05; this.acceleratingFactor = 1.25; minTargetPercent = 0.8; this.minSaleTarget = minSaleTarget; this.totalCompensation = fixedCompensation;
}
public double getFixedCompensation() { return fixedCompensation; }
public void setFixedCompensation(double fixedCompensation) {
this.fixedCompensation = fixedCompensation;
}
public double getVariablePercent() { return variablePercent; }
public void setVariablePercent(double variablePercent) { this.variablePercent = variablePercent; }
public double calculateTotalCompensation(double sales) {
// Checks if the sales has reached or exceeded the minimum sale target if (sales >= (getMinSaleTarget() * minTargetPercent)) {
if (sales > getMinSaleTarget()) { totalCompensation = getFixedCompensation()+(sales - getMinSaleTarget()) * getAcceleratingFactor()*getVariablePercent() + getMinSaleTarget()*getVariablePercent(); } else { totalCompensation = getFixedCompensation() + sales * getVariablePercent();
}
} else { totalCompensation = getFixedCompensation(); }
return totalCompensation;
}
public double getMinSaleTarget() { return minSaleTarget; }
public void setMinSaleTarget(double minSaleTarget) { this.minSaleTarget = minSaleTarget; }
public double getAcceleratingFactor() { return acceleratingFactor; }
public void setAcceleratingFactor(double acceleratingFactor) { this.acceleratingFactor = acceleratingFactor; }
}
class SalespersonCalc {
/** *