Published: 12 May 2024 › Updated: 12 May 2024

Salary
public class SalaryCalculator {
public double multiplierPerDaysSkipped(int daysSkipped) {
return daysSkipped > 5 ? 1 - 0.15 : 1.0;
}
public int multiplierPerProductsSold(int productsSold) {
return productsSold > 20 ? 13 : 10;
}
public double bonusForProductSold(int productsSold) {
return multiplierPerProductsSold(productsSold)\*productsSold;
}
public double finalSalary(int daysSkipped, int productsSold) {
int base = 1000;
double bonusP = bonusForProductSold(productsSold);
double tot = daysSkipped < 5 ? base + bonusP: base\*multiplierPerDaysSkipped(daysSkipped) + bonusP;
return tot >= 2000.0 ? 2000.0: tot;
}
}Leave Salary to:
Read more #info posts
Best Posts From Alessandra
We have not curated any of drago18121996's posts yet. But you can encourage our curation team to review posts by visiting them regularly and by referring other readers. Because we give priority to frequently read content.