Пример #1
0
        static void Main(string[] args)
        {
            Console.WriteLine("New odometer");
            FuelGauge fuelGauge = new FuelGauge();
            Odometer  odometer  = new Odometer(fuelGauge);

            int filledLiters         = 7;
            int killometersTravelled = 101;

            for (int i = 0; i < filledLiters; i++)
            {
                fuelGauge.IncreaseOfFuel();
            }

            Console.WriteLine($"Fuel level: {fuelGauge.ReportLevel()}");
            Console.WriteLine("running");

            for (int i = 0; i < killometersTravelled; i++)
            {
                odometer.MaxMileage();
                odometer.ReportMileage();
                Console.WriteLine($"Odometer report: {odometer.ReportMileage()} km, Fuel level: {fuelGauge.ReportLevel()}");
            }


            Console.ReadLine();
        }
Пример #2
0
        static void Main(string[] args)
        {
            var fuelGauge = new FuelGauge();
            var odometr   = new Odometer(fuelGauge);



            for (var i = 0; i < 7; i++)
            {
                fuelGauge.Fill();
            }

            for (var i = 0; i < 101; i++)
            {
                odometr.Increment();
                Console.WriteLine(odometr.ReportMileage());
                Console.WriteLine(fuelGauge.ReportLevel() + "litri");

                Console.ReadKey();
            }


            Console.ReadKey();
        }