Пример #1
0
        static void Main(string[] args)
        {
            Console.WriteLine("Welcome to Cab Invoice Generator!");
            InvoiceGenerator ig   = new InvoiceGenerator(RideType.NORMAL);
            double           fare = ig.CalculateFare(2.0, 5);

            Console.WriteLine($"Total Fare for the journey : {fare}");
        }
Пример #2
0
        static void Main(string[] args)
        {
            Console.WriteLine("Welcome to Cab Invoice Generator");
            InvoiceGenerator invoiceGenerator = new InvoiceGenerator(RideType.NORMAL);
            double           fare             = invoiceGenerator.CalculateFare(2.0, 5);

            Console.WriteLine($"Fare : {fare}");
        }
Пример #3
0
        /// <summary>
        /// Defines the entry point of the application.
        /// </summary>
        /// <param name="args">The arguments.</param>
        public static void Main(string[] args)
        {
            Console.WriteLine("Welcome to Cab Invoice Program");
            InvoiceGenerator invoiceGenerator = new InvoiceGenerator();
            double           fare             = invoiceGenerator.CalculateFare(2.0, 5);

            Console.WriteLine($"Fare: {fare}");
        }
        /// <summary>
        /// UC 4 Gets the total invoice summary.
        /// </summary>
        /// <param name="userId">The user identifier.</param>
        /// <returns></returns>
        public InvoiceSummary TotalInvoiceSummary(string userId)
        {
            List <Ride>    totalRides  = GetAllUserRides(userId);
            InvoiceSummary normalRides = new InvoiceGenerator(RideType.NORMAL).GetInvoiceSummary(
                totalRides.FindAll(ride => ride.rideType == RideType.NORMAL));
            InvoiceSummary premiumRides = new InvoiceGenerator(RideType.PREMIUM).GetInvoiceSummary(
                totalRides.FindAll(ride => ride.rideType == RideType.PREMIUM));

            return(normalRides + premiumRides);
        }
        static void Main(string[] args)
        {
            Console.WriteLine("Welcome to CabInvoiceGenerator Problem");

            InvoiceGenerator invoice = new InvoiceGenerator(RideType.NORMAL);

            double fare = invoice.calculateFare(2, 5);

            Console.WriteLine("Fare :" + fare);
        }
Пример #6
0
        static void Main(string[] args)
        {
            Console.WriteLine("|**********************************************************************************************************************|");
            Console.WriteLine("|===================================== WELCOME TO CAB INVOICE GENERATOR ===============================================|");
            Console.WriteLine("|______________________________________________________________________________________________________________________|");

            InvoiceGenerator invoiceGenerator = new InvoiceGenerator(RideType.NORMAL);
            double           fare             = invoiceGenerator.CalculateFare(2.0, 5);

            Console.WriteLine($"Fare =  +{ fare}");
        }
Пример #7
0
 static void Main(string[] args)
 {
     /*
      * Console.WriteLine("Welcome To Cab Invoice Generator");
      * Console.WriteLine("================================");
      * InvoiceGenerator invoiceGenerator = new InvoiceGenerator(RideType.PREMIUM);
      * double fare = invoiceGenerator.CalculateFare(2.0, 5);
      * Console.WriteLine($"Fare : {fare}");
      */
     InvoiceGenerator invoiceGenerator = new InvoiceGenerator();
     double           fare             = invoiceGenerator.CalculateFare(2.0, 5);
 }
        //Calculate the aggregate fare, average far and total number of rides
        public Tuple <int, int, double> aggregateFare(Ride[] rides)
        {
            //variable initialize
            int aggregateFare     = 0;
            int totalNumbeOfRides = 0;

            //create instance variable
            InvoiceGenerator cabInvoice = new InvoiceGenerator();

            //calculate aggregate fare according to total no. of rides
            foreach (Ride ride in rides)
            {
                aggregateFare = aggregateFare + cabInvoice.totalFair(ride.distanceInKm, ride.timeInMinute);
                totalNumbeOfRides++;
            }

            //calculate average per ride
            double averageFarePerRide = aggregateFare / totalNumbeOfRides;

            return(new Tuple <int, int, double>(aggregateFare, rides.Length, averageFarePerRide));
        }