Esempio n. 1
0
        public double[] CalculateRates(UberRates data)
        {
            double[] cost = new double[_cost_per_minute.Length];

            for (int i = 0; i < _cost_per_minute.Length; i++)
            {
                cost[i] = (_cost_per_minute[i] * _ride_time) + (_cost_per_mile[i] * _ride_distance);
            }

            return(cost);
        }
Esempio n. 2
0
        static void Main(string[] args)
        {
            double[] costPerMin  = { 0.2, 0.35, 0.4, 0.45 };
            double[] costPerMile = { 1.1, 1.8, 2.3, 3.5 };

            var rideData = new UberRates(30, 7, costPerMin, costPerMile);

            Console.WriteLine(rideData.ride_time);
            rideData.ride_time = 35;
            Console.WriteLine(rideData.ride_time);

            foreach (double cost in rideData.CalculateRates(rideData))
            {
                Console.WriteLine(cost);
            }
        }