static public Car AddNewCar(int flag) { if (flag == 1) { Console.WriteLine("Color : "); string color = Console.ReadLine(); Console.WriteLine("Wheels : "); Assist.NumberCheck(Console.ReadLine(), out int wheels); Console.WriteLine("Speed : "); Assist.NumberCheck(Console.ReadLine(), out int speed); Console.WriteLine("Distance : "); Assist.NumberCheck(Console.ReadLine(), out int distance); Console.WriteLine("Broken : "); bool izBroken = Assist.DefineBool(Console.ReadLine()); Console.WriteLine("Fuel(in L) : "); Assist.NumberCheck(Console.ReadLine(), out int fuel); Console.WriteLine("Maximum Fuel(in L) : "); Assist.NumberCheck(Console.ReadLine(), out int maxFuel); Console.WriteLine("Fuel Consumption : "); Assist.NumberCheck(Console.ReadLine(), out int consumption); Console.WriteLine("Height : "); Assist.NumberCheck(Console.ReadLine(), out int height); Console.WriteLine("Length : "); Assist.NumberCheck(Console.ReadLine(), out int length); Console.WriteLine("Weight : "); Assist.NumberCheck(Console.ReadLine(), out int weight); return(new Car(fuel, maxFuel, consumption, CarType.HatchBack, height, length, weight, speed, wheels, color, izBroken, distance)); } else { Console.WriteLine("Color : "); string colour = Console.ReadLine(); Console.WriteLine("Distance : "); Assist.NumberCheck(Console.ReadLine(), out int dist); Console.WriteLine("Fuel(in L) : "); Assist.NumberCheck(Console.ReadLine(), out int fue); bool isBroken = Assist.DefineBool(Console.ReadLine()); switch (flag) { case 2: return(new VolkswagenGolf(fue, isBroken, colour, dist)); case 3: return(new VolvoXC70(fue, isBroken, colour, dist)); default: return(new ChevroletMalibu(fue, isBroken, colour, dist)); } } }
static public Vehicle AddNewVehicle() { Console.WriteLine("Type : "); string type = Console.ReadLine(); Console.WriteLine("Color : "); string color = Console.ReadLine(); Console.WriteLine("Wheels : "); int wheels; Assist.NumberCheck(Console.ReadLine(), out wheels); Console.WriteLine("Speed : "); int speed; Assist.NumberCheck(Console.ReadLine(), out speed); Console.WriteLine("Distance : "); int distance; Assist.NumberCheck(Console.ReadLine(), out distance); Console.WriteLine("Broken : "); string isBroken = (Console.ReadLine()); bool izBroken = Assist.DefineBool(isBroken); return(new Vehicle(type, speed, wheels, color, izBroken, distance)); }
static void VehicleChoice(List <Vehicle> garage, out int index) { int size = garage.Count(); do { Console.WriteLine("Choose the vehicle by its id (from 0 to {0})", size); Assist.NumberCheck(Console.ReadLine(), out index); } while (index >= size); }
static void BikeChoice(List <Bike> garage, out int index) { int size = garage.Count(); do { Console.WriteLine("Choose the vehicle by its id (from 0 to {0})", size - 1); for (int i = 0; i < size; i++) { Console.Write($"№ {i} - "); garage[i].PrintInfo(); } Assist.NumberCheck(Console.ReadLine(), out index); } while (index >= size); Console.Clear(); }
static public Bike AddNewBike() { Console.WriteLine("Color : "); string color = Console.ReadLine(); Console.WriteLine("Wheels : "); Assist.NumberCheck(Console.ReadLine(), out int wheels); Console.WriteLine("Speed : "); Assist.NumberCheck(Console.ReadLine(), out int speed); Console.WriteLine("Distance : "); Assist.NumberCheck(Console.ReadLine(), out int distance); Console.WriteLine("Broken : "); bool izBroken = Assist.DefineBool(Console.ReadLine()); return(new Bike(speed, wheels, color, izBroken, distance)); }