Exemple #1
0
        private static void MyBikes()
        {
            Bike b1 = new Bike("Brand1", "Red", "Road", 22, 8, 700, 8, 23, 32);
            Console.WriteLine(b1);
            Bike b2 = new Bike("Brand2", "Blue", "City", 1, 1, 700, 5, 28, 32);
            Console.WriteLine(b2);
            Bike b3 = new Bike("Brand3", "Green", "Mounten", 21, 2, 700, 4, 48, 36);
            Console.WriteLine(b3);
            Bike b4 = new Bike("Brand4", "Pink", "Hybrid", 7, 3, 700, 6, 30, 32);
            Console.WriteLine(b4);

            Console.WriteLine("------------------");

            b4.ToString();
            Console.WriteLine($"Active gear: {b4.ActiveGear}.");
            b4.ChangeGear(-4);
            Console.WriteLine($"Active gear: {b4.ActiveGear}.");

            b4.RingBell();
        }
        private static void CallInterfaceClassToExample3Output()
        {
            // creating an instance of Bicycle
            // doing some operations
            Bicycle bicycle = new Bicycle();

            bicycle.ChangeGear(2);
            bicycle.SpeedUp(3);
            bicycle.ApplyBrakes(1);

            Console.WriteLine("Bicycle present state :");
            bicycle.printStates();

            // creating instance of bike.
            Bike bike = new Bike();

            bike.ChangeGear(1);
            bike.SpeedUp(4);
            bike.ApplyBrakes(3);

            Console.WriteLine("Bike present state :");
            bike.printStates();
        }