public static Engine LoadEngine() { Console.Write("Enter capacity: "); double capacity = double.Parse(Console.ReadLine()); Console.Write("Enter power: "); double power = double.Parse(Console.ReadLine()); Engine.FuelType fuelType = GetFuelType(); return(new Engine(capacity, power, fuelType)); }
public Motorcycle(string str) : base() { string[] tokens = str.Split(','); AdvTitle = tokens[0]; Price = double.Parse(tokens[1]); Descrption = tokens[2]; double capacity = double.Parse(tokens[3]); double power = double.Parse(tokens[4]); Engine.FuelType type = (tokens[5] == "Petrol") ? Engine.FuelType.Petrol : Engine.FuelType.Diesel; Engine = new Engine(capacity, power, type); Condition = bool.Parse(tokens[6]); Deleted = bool.Parse(tokens[7]); }
public Car(string str) : base() { string[] tokens = str.Split(','); AdvTitle = tokens[0]; Price = double.Parse(tokens[1]); Descrption = tokens[2]; double capacity = double.Parse(tokens[3]); double power = double.Parse(tokens[4]); Engine.FuelType type = (tokens[5] == "Petrol") ? Engine.FuelType.Petrol : Engine.FuelType.Diesel; Engine = new Engine(capacity, power, type); Brand = tokens[6]; Model = tokens[7]; NumOfDoors = int.Parse(tokens[8]); Condition = bool.Parse(tokens[9]); Deleted = bool.Parse(tokens[10]); Equipment = new List <string>(); for (int i = 11; i < tokens.Length; i++) { Equipment.Add(tokens[i]); } }