Inheritance: NeedForSpeed.Car
Esempio n. 1
0
        static void Main(string[] args)
        {
            var car = new SportCar(100, 100);

            car.Drive(10);
            Console.WriteLine(car.Fuel);
        }
Esempio n. 2
0
        public static void Main(string[] args)
        {
            var ferari = new SportCar(400, 200);

            ferari.Drive(100);
            Console.WriteLine(ferari.Fuel);
        }
Esempio n. 3
0
        public static void Main(string[] args)
        {
            SportCar sportCar = new SportCar(100, 50);

            sportCar.Drive(200);
            Console.WriteLine($"{sportCar.GetType().Name} {sportCar.Fuel}");
        }
        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);
        }
Esempio n. 5
0
        static void Main(string[] args)
        {
            Vehicle vehicle = new Vehicle(120, 20);

            vehicle.Drive(10);
            SportCar sportCar = new SportCar(200, 50);

            sportCar.Drive(100);

            Console.WriteLine(vehicle);
        }
Esempio n. 6
0
        public static void Main(string[] args)
        {
            Car car = new Car(130, 40);

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

            SportCar sportCar = new SportCar(600, 50);

            Console.WriteLine(sportCar.FuelConsumption);
        }
Esempio n. 7
0
        public static void Main(string[] args)
        {
            Car car = new Car(5, 10);

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

            SportCar sport = new SportCar(25, 10);

            sport.Drive(1);
            Console.WriteLine(sport.Fuel);
        }
Esempio n. 8
0
        static void Main(string[] args)
        {
            RaceMotorcycle racer = new RaceMotorcycle(250, 80);

            racer.Drive(10);
            Console.WriteLine(racer.Fuel);
            Vehicle trial = new SportCar(160, 120);

            Console.WriteLine(trial.GetType());
            Car car = new Car(120, 200);

            Console.WriteLine(car.FuelConsumption);
        }
Esempio n. 9
0
        public static void Main(string[] args)
        {
            SportCar sport = new SportCar(100, 100);

            Console.WriteLine($"sportcar {sport.FuelConsumption}");

            RaceMotorcycle moto = new RaceMotorcycle(100, 100);

            Console.WriteLine($"racemotor {moto.FuelConsumption}");

            Car car = new Car(100, 100);

            Console.WriteLine($"car {car.FuelConsumption}");
        }
Esempio n. 10
0
        public static void Main(string[] args)
        {
            Vehicle vehicle        = new Vehicle(300, 100);
            Vehicle car            = new Car(100, 100);
            Vehicle raceMotorcycle = new RaceMotorcycle(100, 100);
            Vehicle raceCar        = new SportCar(100, 100);

            vehicle.Drive(10);
            car.Drive(10);
            raceMotorcycle.Drive(10);
            raceCar.Drive(10);

            Console.WriteLine(vehicle.Fuel);
            Console.WriteLine(car.Fuel);
            Console.WriteLine(raceMotorcycle.Fuel);
            Console.WriteLine(raceCar.Fuel);
        }
Esempio n. 11
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();
        }
Esempio n. 12
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);
            }
        }
Esempio n. 13
0
        static void Main(string[] args)
        {
            Car car = new Car(120, 80);

            Console.WriteLine($"Type: {car.GetType().Name}, " +
                              $"FuelConsumption: {car.FuelConsumption}");



            RaceMotorcycle raceMotor = new RaceMotorcycle(500, 50);

            Console.WriteLine($"Type: {raceMotor.GetType().Name}, " +
                              $"FuelConsumption: {raceMotor.FuelConsumption}");



            SportCar sportCar = new SportCar(550, 120);

            Console.WriteLine($"Type: {sportCar.GetType().Name}, " +
                              $"FuelConsumption: {sportCar.FuelConsumption}");
        }
Esempio n. 14
0
        static void Main(string[] args)
        {
            Vehicle    vehicle    = new Vehicle(200, 50);
            Car        car        = new Car(200, 50);
            SportCar   sportCar   = new SportCar(200, 50);
            Motorcycle motorCycle = new Motorcycle(200, 50);

            Console.WriteLine(vehicle);
            Console.WriteLine(motorCycle);
            Console.WriteLine(car);
            Console.WriteLine(sportCar);

            vehicle.Drive(20);
            car.Drive(20);
            sportCar.Drive(20);
            motorCycle.Drive(20);

            Console.WriteLine(vehicle);
            Console.WriteLine(motorCycle);
            Console.WriteLine(car);
            Console.WriteLine(sportCar);
        }
Esempio n. 15
0
        public static void Main()
        {
            SportCar sportCar = new SportCar(300, 30.00);

            FamilyCar familyCar = new FamilyCar(100, 10.00);

            RaceMotorcycle raceMotorcycle = new RaceMotorcycle(200, 20.00);

            Vehicle vehicle = new Vehicle(80, 8.00);


            Console.WriteLine(sportCar.FuelConsumption);
            sportCar.Drive(2);

            Console.WriteLine(familyCar.FuelConsumption);
            familyCar.Drive(2);

            Console.WriteLine(raceMotorcycle.Fuel);
            raceMotorcycle.Drive(2);

            Console.WriteLine(vehicle.HorsePower);
            vehicle.Drive(2);
        }
Esempio n. 16
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);
        }
Esempio n. 17
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
        }
Esempio n. 18
0
        static void Main(string[] args)
        {
            Vehicle lambo = new SportCar(200, 80);

            Console.WriteLine(lambo.GetType());
        }
Esempio n. 19
0
        public static void Main(string[] args)
        {
            SportCar sportCar = new SportCar(240, 50.5);

            System.Console.WriteLine(sportCar.FuelConsumption);
        }