private double CalculateTotal(int value, BikeRentalType bikeRentalType, int discount) { double result; switch (bikeRentalType) { case BikeRentalType.Hour: result = PriceByHour * value; break; case BikeRentalType.Day: result = PriceByDay * value; break; case BikeRentalType.Week: result = PriceByWeek * value; break; default: throw new NotImplementedException(); } double discountAux = (discount * result) / 100; result = result - discountAux; return(result); }
private DateTime CalculateReturnDate(int value, BikeRentalType bikeRentalType) { DateTime result; switch (bikeRentalType) { case BikeRentalType.Hour: result = GetBusinessTime().AddHours(value); break; case BikeRentalType.Day: result = GetBusinessTime().AddDays(value); break; case BikeRentalType.Week: result = GetBusinessTime().AddDays(value * 7); break; default: throw new NotImplementedException(); } return(result); }