private static void DriveOrRefuelVehicle(IDrivable car, IDrivable truck, string[] input, string command, double thirdParameter) { switch (command) { case "Drive": if (input[1] == "Car") { car.Drive(thirdParameter); } else if (input[1] == "Truck") { truck.Drive(thirdParameter); } break; case "Refuel": if (input[1] == "Car") { car.Refuel(thirdParameter); } else if (input[1] == "Truck") { truck.Refuel(thirdParameter); } break; default: throw new ArgumentException("Invalid vehicle!"); } }