public PoliceCar Create(int mileage, bool serviceRequired) { PoliceCar policeCar = new PoliceCar(); policeCar.ReadForService = serviceRequired; policeCar.Mileage = mileage; return policeCar; }
/// <summary> /// runnning a car by catType /// </summary> /// <param name="carType">car</param> /// <returns>if catType found return true, else return false.</returns> public static bool RunCar(string carType) { ICar car = null; switch (carType) { case "FireEngine": car = new FireEngine(); break; case "Bus": car = new Bus(); break; case "PoliceCar": car = new PoliceCar(); return(true); default: return(false); } car.Run(); return(true); }
static void Main(string[] args) { PoliceCar p = new PoliceCar(); p.Emergency(); p.LandVehicle(); }
public static void PoliceCarStatus() { var policeCar = new PoliceCar(); policeCar.EmergencyPrintStatus(); policeCar.LandVehiclePrintStatus(); }
public PoliceCar New(int mileage, bool serviceRequired) { PoliceCar policeCar = new PoliceCar(); policeCar.ServiceRequired = serviceRequired; policeCar.Mileage = mileage; return policeCar; }
public PoliceCar Create(int mileage, bool serviceRequired) { PoliceCar policeCar = new PoliceCar(); policeCar.ReadForService = serviceRequired; policeCar.Mileage = mileage; return(policeCar); }
public PoliceCar New(int mileage, bool serviceRequired) { PoliceCar policeCar = new PoliceCar(); policeCar.Mileage = mileage; policeCar.requiresService = serviceRequired; return(policeCar); }
/// <summary> /// runnning a car by catType /// </summary> /// <param name="carType">car</param> /// <returns>if catType found return true, else return false.</returns> public static bool RunCar(string carType) { switch (carType) { case "FireEngine": FireEngine fire = new FireEngine(); fire.RunFireEngine(); return(true); case "Bus": Bus bus = new Bus(); bus.RunBus(); return(true); case "PoliceCar": PoliceCar police = new PoliceCar(); police.RunPoliceCar(); return(true); default: return(false); } }
public void CreatePoliceCarTest() { Car car = new PoliceCar(0, 0, 0, 0, "police"); Assert.IsNotNull(car); }
public void GetPoliceCarResourceTest() { Car car = new PoliceCar(0, 0, 0, 0, "police"); string actualString = car.GetCarImageResource(); string shouldBeString = "image_police_car.png"; Assert.AreEqual(shouldBeString, actualString); }