Salary

in #infolast month

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;     
    

      

   } 
    

      

}