public Garage <T> CreateAGarage(string name, string address, int capacity) { Garage <T> garage = new Garage <T>(name, address, capacity); return(garage); }
private static void ParkVehicle(Garage <Vehicle> garage) { Console.Clear(); GarageHandler <Vehicle> handler = new GarageHandler <Vehicle>(); Console.WriteLine(" PARKERING YOUR VEHICLE"); Console.WriteLine("----------------------------------------------------------------------"); Console.WriteLine("What type of vehicle you want to park? \nPlease, choosing one of the following options:" + "\n1) AIRPLANE" + "\n2) BOAT" + "\n3) BUS" + "\n4) CAR" + "\n5) MOTORCYCLE"); string userinput = Console.ReadLine(); Console.WriteLine("Please answer the next questions...\n"); Console.Write("What is the registration number of your vehicle? "); string regNr = Console.ReadLine(); Console.Write("What is the color of the vehicle? "); string color = Console.ReadLine(); string numberOfWheels = Console.ReadLine(); int number; Console.WriteLine("How many wheels does your vehicle have? "); while (!int.TryParse(Console.ReadLine(), out number)) { Console.Write("Invalid number! Please try again. "); } while (!int.TryParse(Console.ReadLine(), out number)) { Console.Write("Invalid number! Please try again. "); } if (userinput == "1") { userinput = "Airplane"; string numof = Console.ReadLine(); Console.WriteLine("How many engines does your airplane have? "); while (!int.TryParse(Console.ReadLine(), out number)) { Console.Write("Invalid number! Please try again. "); } Airplane a = new Airplane(regNr, color, number, number); handler.ParkVehicle(garage, a, 0); } else if (userinput == "2") { userinput = "Boat"; Console.WriteLine("What is the length of your boat? "); while (!int.TryParse(Console.ReadLine(), out number)) { Console.WriteLine("Invalid number! Please try again. "); } Boat a = new Boat(regNr, color, number, number); handler.ParkVehicle(garage, a, 0); } else if (userinput == "3") { userinput = "Car"; Console.WriteLine("Which fuel type does your car have? "); string fuel = Console.ReadLine(); Car a = new Car(regNr, color, number, fuel); handler.ParkVehicle(garage, a, 0); } else if (userinput == "4") { userinput = "Motorcycle"; Console.WriteLine("How much cylinder volume does your motorcycle have? "); while (!int.TryParse(Console.ReadLine(), out number)) { Console.WriteLine("Invalid input! Please try again. "); } Motorcycle a = new Motorcycle(regNr, color, number, number); handler.ParkVehicle(garage, a, 0); } Console.WriteLine("\n--------------Parked vehicle---------------"); Console.WriteLine(handler.ShowVehicleList(garage)); Console.ReadLine(); }
public int GetCapacity(Garage <T> garage) { return(garage.Capacity); }
public int GetCount(Garage <T> garage) { return(garage.Count); }
public string GetAddress(Garage <T> garage) { return(garage.Address); }
public void SetCapacity(Garage <T> garage, int capacity) { garage.Capacity = capacity; }
public string TypeVehicle(Garage <Vehicle> garage) { return(garage.ListType()); }
public void SetAddress(Garage <T> garage, string address) { garage.Address = address; }
public string GetName(Garage <T> garage) { return(garage.Name); }
public string ShowVehicleList(Garage <Vehicle> garage) { return(garage.List()); }
public void SetName(Garage <T> garage, string name) { garage.Name = name; }