Esempio n. 1
0
        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);
        }
Esempio n. 2
0
        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);
        }