static void Main(string[] args)
        {
            Vehicle vehicle = new Vehicle(800, 70);

            Console.WriteLine(vehicle.DefaultFuelConsumption); // 1.25

            Car car = new Car(50, 5);

            car.Drive(500);

            FamilyCar familyCar = new FamilyCar(100, 50);
            SportCar  sportCar  = new SportCar(10, 1);

            Console.WriteLine(car.DefaultFuelConsumption);       // 3
            Console.WriteLine(familyCar.DefaultFuelConsumption); // 3
            Console.WriteLine(sportCar.DefaultFuelConsumption);  // 10

            Motorcycle      motorcycle      = new Motorcycle(3, 33);
            CrossMotorcycle crossMotorcycle = new CrossMotorcycle(2, 22);
            RaceMotorcycle  raceMotorcycle  = new RaceMotorcycle(66, 6);

            Console.WriteLine(motorcycle.DefaultFuelConsumption);      // 1.25
            Console.WriteLine(crossMotorcycle.DefaultFuelConsumption); // 1.25
            Console.WriteLine(raceMotorcycle.DefaultFuelConsumption);  // 8

            raceMotorcycle.Drive(500);
        }
示例#2
0
        public static void Main()
        {
            FamilyCar myFamilyCar = new FamilyCar(250, 50);

            myFamilyCar.Drive(3);
            Console.WriteLine(myFamilyCar);

            RaceMotorcycle myRaceMotorcycle = new RaceMotorcycle(20, 10);

            myRaceMotorcycle.Drive(0.5);
            Console.WriteLine(myRaceMotorcycle);

            CrossMotorcycle myCrossMotorCycle = new CrossMotorcycle(15, 20);

            myCrossMotorCycle.Drive(10);
            Console.WriteLine(myCrossMotorCycle);
        }
示例#3
0
        static void Main(string[] args)
        {
            Vehicle         viechele        = new Vehicle(10, 100);
            Motorcycle      motorcycle      = new Motorcycle(10, 100);
            Car             car             = new Car(10, 100);
            RaceMotorcycle  raceMotorcycle  = new RaceMotorcycle(10, 100);
            CrossMotorcycle crossMotorcycle = new CrossMotorcycle(10, 100);
            SportCar        sportcar        = new SportCar(10, 100);
            FamilyCar       familyCar       = new FamilyCar(10, 100);

            viechele.Drive(10);
            car.Drive(10);
            motorcycle.Drive(10);
            raceMotorcycle.Drive(10);
            crossMotorcycle.Drive(10);
            familyCar.Drive(10);
            sportcar.Drive(10);
            Console.WriteLine();
        }
示例#4
0
        public static void Main(string[] args)
        {
            var sportCar        = new SportCar(10, 42.2);
            var motorCycle      = new Motorcycle(5, 55.2);
            var crossMotorcycle = new CrossMotorcycle(30, 40.2);

            List <Vehicle> vechh = new List <Vehicle>();

            vechh.Add(sportCar);
            vechh.Add(motorCycle);
            vechh.Add(crossMotorcycle);

            foreach (var item in vechh)
            {
                Console.WriteLine(item.Fuel);
                item.Drive(5);
                Console.WriteLine(item.Fuel);
            }
        }
示例#5
0
        static void Main(string[] args)
        {
            Vehicle veh = new Vehicle(45, 10);

            veh.Drive(50);
            Console.WriteLine(veh.Fuel);

            Motorcycle mot = new Motorcycle(45, 10);

            mot.Drive(50);
            Console.WriteLine(mot.Fuel);

            Car car = new Car(45, 10);

            car.Drive(50);
            Console.WriteLine(car.Fuel);

            RaceMotorcycle race = new RaceMotorcycle(45, 10);

            race.Drive(50);
            Console.WriteLine(race.Fuel);

            CrossMotorcycle crossMotor = new CrossMotorcycle(45, 10);

            crossMotor.Drive(50);
            Console.WriteLine(crossMotor.Fuel);

            FamilyCar famcar = new FamilyCar(45, 10);

            famcar.Drive(50);
            Console.WriteLine(famcar.Fuel);

            SportCar sportCar = new SportCar(45, 10);

            sportCar.Drive(50);
            Console.WriteLine(sportCar.Fuel);
        }
示例#6
0
        public static void Main(string[] args)
        {
            var motor = new Motorcycle(100, 2.5);

            motor.Drive(100);
            Console.WriteLine(motor.Fuel); //1.25

            var motorRace = new RaceMotorcycle(50, 10);

            motorRace.Drive(100);
            Console.WriteLine(motorRace.Fuel); //2

            var motorCross = new CrossMotorcycle(50, 2.5);

            motorCross.Drive(100);
            Console.WriteLine(motorCross.Fuel); //1.25

            //Car car = new Car(100, 3);
            //car.Drive(100);
            //Console.WriteLine(car.Fuel);

            var car2 = new FamilyCar(100, 3);

            car2.Drive(100);
            Console.WriteLine(car2.Fuel); //0

            var sportCar = new SportCar(50, 10);

            sportCar.Drive(50);
            Console.WriteLine(sportCar.Fuel); //5

            Car car = new Car(100, 3);

            car.Drive(100);
            Console.WriteLine(car.Fuel); //0
        }