/// <summary> /// Calculates the price for the rental period after the "flat period" - period with a fixed price /// independent on the number of days in the period. The price for the "trailing days" depends on the /// day count. /// </summary> /// <param name="rentalDays">the whole duration of the rental period in days,</param> /// <param name="terms">the set of rental terms for the chosen video title type.</param> /// <returns>The price for the "trailing days" of the rental period.</returns> private decimal GetTrailingDaysPrice(int rentalDays, RentalTerms terms) { if (rentalDays > terms.FlatPeriodDays) { return((rentalDays - terms.FlatPeriodDays) * terms.TrailingFee); } return(0); }
private static int GetPriceInPoints(int rentalDays, RentalTerms terms) { return(rentalDays * terms.RentalDayPriceInPoints); }
private bool IsPaymentByPointsPossible(int rentalDays, int bonusPoints, RentalTerms terms) { int priceInPoints = GetPriceInPoints(rentalDays, terms); return(terms.IsPaymentByPointsAllowed && (bonusPoints >= priceInPoints)); }