public void TurnOnEngine(Object o, GenericVehicle v) { if (o.GetType() == typeof(Person)) { engine_running = true; StringBuilder sb = new StringBuilder(); sb.AppendFormat("The engine is now firing all {0} cylinders.\n", v.GetCylinders()); Console.WriteLine(sb); } else { Console.WriteLine("You need to be a person to drive a car.\n"); } }
public void TurnOffEngine(Object o, GenericVehicle v) { if (o.GetType() == typeof(Person)) { if (Is_Parked(v) == false) { Console.WriteLine("You're crazy, that'll ruin your car, mate\n"); } else { engine_running = false; StringBuilder sb = new StringBuilder(); sb.AppendFormat("The engine has now stopped firing all {0} cylinders.\n", v.GetCylinders()); Console.WriteLine(sb); } } else { Console.WriteLine("You need to be a human to turn off the car.\n"); } }