static void Main() { Car car = (Car)VehicleFactory.CreateVehicle(); Truck truck = (Truck)VehicleFactory.CreateVehicle(); Bus bus = (Bus)VehicleFactory.CreateVehicle(); int numberOfCommands = int.Parse(Console.ReadLine()); for (int i = 0; i < numberOfCommands; i++) { string[] commands = Console.ReadLine().Split(new char[] { ' ' }, StringSplitOptions.RemoveEmptyEntries); string action = commands[0]; string vehicleType = commands[1]; double argument = double.Parse(commands[2]); ExecuteAction(car, truck, bus, action, vehicleType, argument); } Console.WriteLine(car); Console.WriteLine(truck); Console.WriteLine(bus); }
static void Main(string[] args) { DataProcessor Data = new DataProcessor(); string FileLocation = @"C: \Users\AminR\source\repos\Vehicles\Persons.txt"; string[] TextFileInputs = Data.GetDataFromTextFile(FileLocation); List <Vehicle> VehicleList = new List <Vehicle>(); bool Driving = true; foreach (string TextFileInput in TextFileInputs) { VehicleFactory vehicles = new VehicleFactory(); int Seats = Convert.ToInt32(Data.ExtractNumberFromString(TextFileInput)); VehicleList.Add(vehicles.CreateVehicle(Seats)); } while (Driving) { Data.VehicleFuelUsage(VehicleList); } Console.ReadKey(); }