Example #1
0
        static void Main(string[] args)
        {
            Car     car1     = new Car();
            Bicycle bicycle1 = new Bicycle();

            car1.Ride();
            bicycle1.Ride();

            Osoba       osoba1     = new Osoba();
            IGitarzysta gitarzysta = osoba1;
            ISkrzypek   skrzypek   = osoba1;

            osoba1.Graj();
            gitarzysta.Graj();
            skrzypek.Graj();
            Console.ReadKey();
        }
Example #2
0
        static void Main(string[] args)
        {
            Car     car1     = new Car();
            Bicycle bicycle1 = new Bicycle();

            car1.Ride();
            bicycle1.Ride();

            Osoba       osoba1 = new Osoba();
            IGitarzysta osoba2 = new Osoba();
            ISkrzypek   osoba3 = new Osoba();

            osoba1.Graj();
            osoba2.Graj();
            osoba3.Graj();
            Console.ReadKey();
        }
Example #3
0
        static void Main(string[] args)
        {
            Bicycle bicycle = new Bicycle();

            bicycle.changeGear(2);
            bicycle.speedUp(3);
            bicycle.applyBrakes(1);
            Console.WriteLine(" Bicycle pesent states:");
            bicycle.printStates();

            Bike bike = new Bike();

            bike.changeGear(1);
            bike.speedUp(5);
            bike.applyBrakes(3);
            Console.WriteLine(" Bike pesent states:");
            bicycle.printStates();
        }
Example #4
0
        public static void Main(String[] args)
        {
            Bicycle b = new Bicycle(25, 40, 25, 1.5, 2);

            b.run();
            Console.WriteLine("单车速度为:" + b.getSpeed() + "km/h" +
                              "\n单车最大速度为:" + b.getMaxSpeed() + "km/h" +
                              "\n单车重量为:" + b.getWeight() + "kg" +
                              "\n单车高度为:" + b.getHeight() + "m" +
                              "\n单车长度为:" + b.getLong() + "m");
            b.stop();
            Car c = new Car(80, 150, 1200, 2, 3, 2, 5);

            c.run();
            Console.WriteLine("小轿车速度为:" + c.getSpeed() + "km/h" +
                              "\n小轿车最大速度为:" + c.getMaxSpeed() + "km/h" +
                              "\n小轿车重量为:" + c.getWeight() + "kg" +
                              "\n小轿车高度为:" + c.getHeight() + "m" +
                              "\n小轿车长度为:" + c.getLong() + "m" +
                              "\n小轿车座位数为:" + c.getSeat());
            c.stop();
        }