private int getIndexThatApplyRule() { for (int i = 0; i < BillScale.Count - 1; i++) { if (getInScaleAmount(BillScale.GetRange(0, i + 1)) > Amount) { return(i); } } return(-1); }
private double getInScalePriceTo(int index) => BillScale.GetRange(0, index).Sum(x => x.Amount * x.Price);
private double getInScaleAmountTo(int index) => BillScale.GetRange(0, index).Sum(x => x.Amount);