Exemple #1
0
        static void Main(string[] args)
        {
            var tires = new Tire[4]
            {
                new Tire(1, 2.5),
                new Tire(1, 2.5),
                new Tire(1, 2.5),
                new Tire(1, 2.5),
            };

            var engine = new Engine(560, 6300);
            var car    = new Car("Lamborghini", "Urus", 2010, 250, 9, engine, tires);
        }
Exemple #2
0
        static void Main(string[] args)
        {
            var tires = new Tire[4]
            {
                new Tire(1, 2.5),
                new Tire(2, 0.5),
                new Tire(2, 2.3),
                new Tire(1, 2.1),
            };

            var engine = new Engine(200, 3000);
            var car    = new Car("Mercedes", "E200", 1990, 70, 10, engine, tires);
        }
Exemple #3
0
        public static void Main()
        {
            var tires = new Tire[4]
            {
                new Tire(1, 2.5),
                new Tire(1, 2.1),
                new Tire(2, 0.5),
                new Tire(2, 2.3)
            };

            var engine = new Engine(560, 6300);
            var car    = new Car("Lambo", "Urus", 2010, 250, 9, engine, tires);
        }
        static void Main(string[] args)
        {
            Tire[] tires = new Tire[4]
            {
                new Tire(1, 2.5),
                new Tire(1, 2.1),
                new Tire(2, 0.5),
                new Tire(2, 2.3),
            };
            Engine engine = new Engine(560, 6300);

            Car car = new Car("Lamborghini", "Urus", 2010, 250, 9, engine, tires);
        }
Exemple #5
0
        static void Main(string[] args)
        {
            var tires = new Tire[4]
            {
                new Tire(2017, 2.20),
                new Tire(1, 1.30),
                new Tire(1, 2.25),
                new Tire(1, 8.25)
            };
            Engine engine = new Engine(560, 6300);

            Car car = new Car("VW", "Polo", 2001, 5, 80, engine, tires);
        }
Exemple #6
0
        static void Main(string[] args)
        {
            Engine engine = new Engine(321, 7658);

            Tire[] tires = new Tire[4]
            {
                new Tire(1, 3.2),
                new Tire(1, 2.2),
                new Tire(2, 0.9),
                new Tire(1, 2.1),
            };

            var car = new Car("Lambo", "Urus", 2010, 3000, 21, engine, tires);
        }
Exemple #7
0
        static void Main(string[] args)
        {
            var tyres = new Tire[4]
            {
                new Tire(2012, 2.2),
                new Tire(2012, 2.2),
                new Tire(2012, 2.5),
                new Tire(2012, 2.5)
            };

            Engine v12 = new Engine(225, 3.0);

            Car lambo = new Car("lambo", "devil", 2020, 70, 25.0, v12, tyres);
        }
Exemple #8
0
        static void Main(string[] args)
        {
            var tires = new Tire[4]
            {
                new Tire(2020, 3),
                new Tire(2020, 3),
                new Tire(2020, 3),
                new Tire(2020, 3)
            };

            var engine = new Engine(800, 12.0);

            var car = new Car("Audi", "A4", 2020, 250, 100, engine, tires);
        }
Exemple #9
0
        static void Main(string[] args)
        {
            var tires = new Tire[4]
            {
                new Tire(1, 1),
                new Tire(1, 1),
                new Tire(1, 1),
                new Tire(1, 1)
            };

            var engine = new Engine(1, 1);

            var car = new Car("L", "U", 2010, 250, 9, engine, tires);
        }
Exemple #10
0
        static void Main(string[] args)
        {
            Tire[] tires = new Tire[4]
            {
                new Tire(1, 2.5),
                new Tire(1, 2.1),
                new Tire(2, 0.5),
                new Tire(2, 2.3),
            };

            Engine engine = new Engine(560, 6300);

            Car car = new Car("Lexus", "IS250", 2006, 60, 11);
        }
        public static void Main(string[] args)
        {
            Tire[] tires = new Tire[4]
            {
                new Tire(1, 2.5),
                new Tire(1, 2.1),
                new Tire(2, 0.5),
                new Tire(2, 2.3),
            };

            Engine engine = new Engine(560, 6300);

            Car car = new Car("VW", "Bettle", 1998, 40, 10, engine, tires);
        }
Exemple #12
0
        static void Main(string[] args)
        {
            var tires = new Tire[4]
            {
                new Tire(1, 2.5),
                new Tire(1, 2.1),
                new Tire(2, 0.5),
                new Tire(2, 2.3)
            };

            var engine = new Engine(500, 2000);

            Car car = new Car("Skoda", "Octavia", 2000, 250, 6, engine, tires);
        }
Exemple #13
0
        static void Main(string[] args)
        {
            var tires = new Tire[4]
            {
                new Tire(1, 2.5),
                new Tire(1, 2.5),
                new Tire(1, 2.5),
                new Tire(1, 2.5),
            };

            var engine = new Engine(560, 6300);

            var car = new Car("VW", "Polo", 1995, 3, 3, engine, tires);
        }
        static void Main(string[] args)
        {
            Car car = new Car();

            Engine engine = new Engine(89, 1700);

            Tire[] tires = new Tire[]
            {
                new Tire(2017, 1200),
                new Tire(2018, 1200),
            };

            Car opel = new Car("Opel", "Corsa", 2003, 40, 6.5, engine, tires);

            Console.WriteLine($"{opel.Make} - {opel.Model} - {opel.Year} - {opel.FuelQuantity} - {opel.FuelConsumption}");
        }
Exemple #15
0
        public static void Main(string[] args)
        {
            Tire[] tires = new Tire[4]
            {
                new Tire(1, 2.5),
                new Tire(1, 2.3),
                new Tire(2, 2.2),
                new Tire(2, 2.4),
            };

            Engine engine = new Engine(560, 6300);

            Car newCar = new Car("Lambo", "Lambo", 2009, 75, 20, engine, tires);

            Console.WriteLine(newCar.WhoAmI());
        }
        private static Tire[] GetTirePack(string[] tireData)
        {
            Tire[] tirePack        = new Tire[4];
            int    indexInTirePack = 0;

            for (int i = 0; i < tireData.Length - 1; i += 2)
            {
                int    year     = int.Parse(tireData[i]);
                double pressure = double.Parse(tireData[i + 1]);

                tirePack[indexInTirePack] = new Tire(year, pressure);
                indexInTirePack++;
            }

            return(tirePack);
        }
Exemple #17
0
        public static void Main(string[] args)
        {
            Tire[] tires = new Tire[4]
            {
                new Tire(1, 2.5),
                new Tire(1, 2.1),
                new Tire(2, 0.5),
                new Tire(2, 2.3)
            };

            Engine engine = new Engine(560, 6300);

            Car car = new Car("Lamborghini", "Urus", 2010, 250, 9, engine, tires);

            Console.WriteLine(car.WhoAmI());
        }
        public static void Main(string[] args)
        {
            var tires = new Tire[4]
            {
                new Tire(1, 2.5),
                new Tire(2, 2.2),
                new Tire(2, 2.2),
                new Tire(2, 2.2),
            };
            var engine = new Engine(560, 6300);

            var car = new Car("Lamborgini", "Urus", 2010, 250, 9, engine, tires);

            Console.WriteLine($"{car.Model} {car.Make} {car.Year} {car.FuelConsumption} {car.FuelQuantity}" +
                              $"{car.Engine} {car.Tires}");
        }
Exemple #19
0
        static void Main(string[] args)
        {
            Engine v12 = new Engine(580, 1200);

            Tire[] tires = new Tire[]
            {
                new Tire(2018, 2.3),
                new Tire(2018, 2.2),
                new Tire(2018, 2.5),
                new Tire(2018, 2.3),
            };

            Car bmw = new Car("BMW", "X6", 1993, 5003, -50, v12, tires);

            Console.WriteLine("Horse power: " + bmw.Engine.HorsePower);

            foreach (var tire in bmw.Tires)
            {
                Console.WriteLine($"{tire.Year} - {tire.Pressure}");
            }



            //Car defaultGolf = new Car();
            //Console.WriteLine($"Default golf: " + defaultGolf.WhoAmI());
            //Car car = new Car();
            //car.Make = "VW";
            //car.Model = "MK3";
            //car.Year = 1992;
            //car.FuelQuantity = 200;
            //car.FuelConsumption = 200;

            //car.Drive(0.5);

            //Car v12 = new Car();
            //v12.Make = "V12";
            //v12.Model = "100kmvchas";
            //v12.Year = 2025;
            //v12.FuelQuantity = 2000000;
            //v12.FuelConsumption = 0;

            //v12.Drive(0.5);

            //Console.WriteLine(v12.WhoAmI());

            //Console.WriteLine(car.WhoAmI());
        }
        public static void Main()
        {
            var    tiresList = new List <Tire []>();
            string input;

            while ((input = Console.ReadLine()) != "No more tires")
            {
                var tireInfo = input.Split();
                var tires    = new Tire[tireInfo.Length / 2];
                for (int i = 0; i < tires.Length; i++)
                {
                    tires[i] = new Tire(int.Parse(tireInfo[i * 2]), double.Parse(tireInfo[i * 2 + 1]));
                }
                tiresList.Add(tires);
            }
            var enginesList = new List <Engine>();

            while ((input = Console.ReadLine()) != "Engines done")
            {
                var engineInfo = input.Split();
                enginesList.Add(new Engine(int.Parse(engineInfo[0]), double.Parse(engineInfo[1])));
            }
            var carsList = new List <Car>();

            while ((input = Console.ReadLine()) != "Show special")
            {
                var carInfo = input.Split();
                carsList.Add(new Car(carInfo[0], carInfo[1], int.Parse(carInfo[2]),
                                     double.Parse(carInfo[3]), double.Parse(carInfo[4]),
                                     enginesList[int.Parse(carInfo[5])], tiresList[int.Parse(carInfo[6])]));
            }
            Func <Car, bool> checker = n => n.Year >= 2017 &&
                                       n.Engine.HorsePower > 300 && (n.GetAllTiresPressure() >= 9) &&
                                       n.GetAllTiresPressure() <= 10;
            var specialCars = carsList.Where(checker).ToList();

            foreach (var spCar in specialCars)
            {
                spCar.Drive(20);
                Console.WriteLine($"Make: {spCar.Make}");
                Console.WriteLine($"Model: {spCar.Model}");
                Console.WriteLine($"Year: {spCar.Year}");
                Console.WriteLine($"HorsePowers: {spCar.Engine.HorsePower}");
                Console.WriteLine($"FuelQuantity: {spCar.FuelQuantity}");
            }
        }
        static void GetAllTiresData(List <Tire[]> allTires, List <string> data)
        {
            Tire[] currTires = new Tire[data.Count / 2];
            int    index     = 0;

            while (data.Count > 0)
            {
                int    year     = int.Parse(data[0]);
                double pressure = double.Parse(data[1]);
                Tire   newTire  = new Tire(year, pressure);
                currTires[index] = newTire;
                data.RemoveRange(0, 2);
                index++;
            }

            allTires.Add(currTires);
        }
Exemple #22
0
        static void Main(string[] args)
        {
            Tire[] tires = new Tire[4]
            {
                new Tire(1, 2.5),
                new Tire(1, 2.1),
                new Tire(2, 0.5),
                new Tire(2, 2.3)
            };
            Engine engine = new Engine(560, 6300);
            Car    car    = new Car("Lamborghini", "Urus", 2010, 250, 9, engine, tires);

            //foreach (Tire tire in tires)
            //{
            //    Console.Write(tire.Year + " ");
            //    Console.WriteLine(tire.Pressure);
            //}
        }
Exemple #23
0
        public static void Main(string[] args)
        {
            /* Car car = new Car();
             *
             * car.Make = "VW";
             * car.Model = "MK3";
             * car.Year = 1992;
             * car.FuelQuantity = 200;
             * car.FuelConsumption = 200;
             * car.Drive(2000);
             *
             * Console.WriteLine($"Make: {car.Make}\nModel: {car.Model}\nYear: {car.Year}");
             * Console.WriteLine(car.WhoAmI());*/

            /*string make = Console.ReadLine();
             * string model = Console.ReadLine();
             * int year = int.Parse(Console.ReadLine());
             * double fuelQuantity = double.Parse(Console.ReadLine());
             * double fuelConsumption = double.Parse(Console.ReadLine());
             *
             * Car firstCar = new Car();
             * Car secondCar = new Car(make, model, year);
             * Car thirdCar = new Car(make, model, year, fuelQuantity, fuelConsumption);
             * firstCar.Drive(2000);
             *
             * Console.WriteLine(firstCar.WhoAmI());
             * Console.WriteLine(secondCar.WhoAmI());
             * Console.WriteLine(thirdCar.WhoAmI()); */

            var tires = new Tire[4]
            {
                new Tire(1, 2.5),
                new Tire(1, 2.1),
                new Tire(2, 0.5),
                new Tire(2, 2.3)
            };

            var engine = new Engine(560, 6300);

            var car = new Car("Lamborghini", "Urus", 2010, 250, 9, engine, tires);

            Console.WriteLine(car.WhoAmI());
        }
Exemple #24
0
        static void Main(string[] args)
        {
            Tire[] tires = new Tire[4]
            {
                new Tire(1, 1.0),
                new Tire(1, 1),
                new Tire(1, 1),
                new Tire(1, 1)
            };
            var engine = new Engine(100, 2.2);

            string make            = "AUDI";
            string model           = "A3";
            int    year            = 1998;
            double fuelQuantity    = 65;
            double fuelConsumption = 16;
            Car    newCar          = new Car(make, model, year, fuelQuantity, fuelConsumption, engine, tires);
            Car    lamboCar        = new Car("Lambo", "Urus", 2010, 250, 9, engine, tires);
        }
Exemple #25
0
        static void Main()
        {
            string        input    = Console.ReadLine();
            List <Tire[]> tireList = new List <Tire[]>();

            while (input != "No more tires")
            {
                Tire[] tires = new Tire[input.Split().Length / 2];
                for (int i = 0; i < input.Split().ToArray().Length; i += 2)
                {
                    string[] split = input.Split(" ", StringSplitOptions.RemoveEmptyEntries).ToArray();
                    tires[i / 2] = new Tire(int.Parse(split[i]), double.Parse(split[i + 1]));
                }
                tireList.Add(tires);
                input = Console.ReadLine();
            }
            List <Engine> engineList = new List <Engine>();

            input = Console.ReadLine();
            while (input != "Engines done")
            {
                string[] split = input.Split(" ", StringSplitOptions.RemoveEmptyEntries).ToArray();
                engineList.Add(new Engine(int.Parse(split[0]), double.Parse(split[1])));
                input = Console.ReadLine();
            }
            List <Car> cars = new List <Car>();

            input = Console.ReadLine();
            while (input != "Show special")
            {
                string[] split = input.Split(" ", StringSplitOptions.RemoveEmptyEntries).ToArray();
                cars.Add(new Car(split[0], split[1], int.Parse(split[2]), double.Parse(split[3]), double.Parse(split[4]), engineList[int.Parse(split[5])], tireList[int.Parse(split[6])]));
                input = Console.ReadLine();
            }
            Func <int, int, double, bool> special = (year, horsePower, pressure) => year >= 2017 && horsePower > 330 && 9 <= pressure && pressure <= 10;
            List <Car> specialCars = cars.Where(car => special(car.Year, car.Engine.HorsePower, car.Tires.Sum(tire => tire.Pressure))).ToList();

            foreach (Car car in specialCars)
            {
                car.Drive(20);
                Console.WriteLine(car.WhoAmI());
            }
        }
Exemple #26
0
        public static void Main(string[] args)
        {
            string make            = Console.ReadLine();
            string model           = Console.ReadLine();
            int    year            = int.Parse(Console.ReadLine());
            double fuelQuantity    = double.Parse(Console.ReadLine());
            double fuelConsumption = double.Parse(Console.ReadLine());

            var tires = new Tire[4]
            {
                new Tire(1, 2.5),
                new Tire(1, 2.1),
                new Tire(2, 0.5),
                new Tire(2, 2.3),
            };

            var engine = new Engine(560, 6300);
            var car    = new Car("Lamborghini", "Urus", 2010, 250, 9, engine, tires);
        }
        static void Main(string[] args)
        {
            Car car = new Car(
                "VW",
                "Golf 2",
                1992,
                200,
                200
                );

            Engine engine = new Engine(650, 1000);

            Tire[] tires = new Tire[]
            {
                new Tire(2008, 1200),
                new Tire(2008, 1200),
                new Tire(2008, 1200),
                new Tire(2008, 1200)
            };
        }
        static void Main(string[] args)
        {
            Engine v12 = new Engine(580, 1200);

            Tire[] tires = new Tire[]
            {
                new Tire(2018, 2.3),
                new Tire(2018, 2.2),
                new Tire(2018, 2.5),
                new Tire(2018, 2.3),
            };
            Car bmw = new Car("BMW", "X6", 1993, 5003, -50, v12, tires);

            Console.WriteLine($"Horse power: " + bmw.Engine.HorsePower);

            foreach (var tire in bmw.Tires)
            {
                Console.WriteLine($"{tire.Year} - {tire.Pressure}");
            }
        }
Exemple #29
0
        static void Main(string[] args)
        {
            var tires = new Tire[4]
            {
                new Tire(1, 2.5),
                new Tire(1, 2.5),
                new Tire(1, 2.5),
                new Tire(1, 2.5)
            };

            Engine engine = new Engine(560, 6300);
            Car    car    = new Car("Lambo", "Urus", 2019, 250, 9, engine, tires);

            Console.WriteLine($"{car.Model} {car.Make} {car.Year} {car.Engine.CubicCapacity} {car.Engine.HorsePower}");

            foreach (var tire in tires)
            {
                Console.WriteLine($"{tire.Pressure} {tire.Year}");
            }
        }
        public static void Main(string[] args)
        {
            var tires = new Tire[4]
            {
                new Tire(1, 2.5),
                new Tire(1, 2.1),
                new Tire(2, 0.5),
                new Tire(2, 2.3)
            };

            var engine = new Engine(560, 6300);
            var car    = new Car("test", "User", 2020, 260, 8, engine, tires);
            var car1   = new Car();
            var car2   = new Car("test", "User", 2020);
            var car3   = new Car("test", "User", 2020, 260, 8);

            Console.WriteLine(car.WhoAmI());
            Console.WriteLine(car1.WhoAmI());
            Console.WriteLine(car2.WhoAmI());
            Console.WriteLine(car3.WhoAmI());
        }