Exemple #1
0
        public string PrintCustomerRentDetails(RentalCars office)
        {
            string report    = "";
            double FullPrice = Car.CalculatePrice(DaysRented, Customer, office);

            if (FullPrice != 0)
            {
                report += $"{Customer.Name}\t";
                report += $"{Car.Model}\t";
                report += $"{DaysRented}d\t";
                report += $"{FullPrice.ToString()} EUR";
            }
            else
            {
                return($"{Customer.Name} can not rent {Car.Model}.");
            }
            return(report);
        }
        static void Main(string[] args)
        {
            RentalCars IasiRentals      = new RentalCars("Iasi Rentals", 1);
            RentalCars BucharestRentals = new RentalCars("Bucuresti Rentals", 1.5);

            var customer1 = new Customer("Ion Popescu");
            var customer2 = new Customer("Mihai Chirica");
            var customer3 = new Customer("Gigi Becali");

            IasiRentals.AddRental(new Rental(customer1, new MiniCar("Mini"), 3));
            IasiRentals.AddRental(new Rental(customer2, new PremiumCar("Premium"), 5));
            IasiRentals.AddRental(new Rental(customer2, new RegularCar("Regular"), 5));
            IasiRentals.AddRental(new Rental(customer3, new LuxuryCar("Luxury"), 1));
            IasiRentals.CustomersReport();

            BucharestRentals.AddRental(new Rental(customer1, new MiniCar("Mini"), 3));
            BucharestRentals.AddRental(new Rental(customer1, new MiniCar("Mini"), 3));
            BucharestRentals.AddRental(new Rental(customer3, new PremiumCar("Premium"), 5));
            BucharestRentals.AddRental(new Rental(customer3, new LuxuryCar("Luxury"), 1));
            BucharestRentals.CustomersReport();

            RentalCars.CarsCategoryRevenueReport();
        }