static void Main(string[] args) { int n = int.Parse(Console.ReadLine()); var carsList = new CarsList(); for (int i = 0; i < n; i++) { var token = Console.ReadLine() .Split() .ToArray(); var model = token[0]; Engine engine = new Engine(int.Parse(token[1]), int.Parse(token[2])); Cargo cargo = new Cargo(token[4], int.Parse(token[3])); Tire[] tires = new Tire[] { new Tire(double.Parse(token[5]), int.Parse(token[6])), new Tire(double.Parse(token[7]), int.Parse(token[8])), new Tire(double.Parse(token[9]), int.Parse(token[10])), new Tire(double.Parse(token[11]), int.Parse(token[12])) }; var car = new Car(model, engine, cargo, tires); carsList.Add(car); } var command = Console.ReadLine(); if (command == "flamable") { carsList.Flamable(); } else if (command == "fragile") { carsList.Fragile(); } }
public Car(string model, Engine engine, Cargo cargo, Tire tire1, Tire tire2, Tire tire3, Tire tire4) { this.Model = model; this.Engine = engine; this.Cargo = cargo; this.Tire1 = tire1; this.Tire2 = tire2; this.Tire3 = tire3; this.Tire4 = tire4; }