public static void SetupAmfibia(ref Amfibia setupAmfibia, int soldierAmount, int amfibiaLandDistance, int amfibiaWaterDistance) { var totalWaterDistance = 0.0; for (var i = 0; i < setupAmfibia.AmountOfTrips(soldierAmount); i++) { totalWaterDistance += setupAmfibia.Swim(amfibiaWaterDistance); } var totalLandDistance = 0.0; for (var i = 0; i < setupAmfibia.AmountOfTrips(soldierAmount); i++) { totalLandDistance += setupAmfibia.Move(amfibiaLandDistance); } setupAmfibia.TotalFuelConsumption = (totalLandDistance + totalWaterDistance) * setupAmfibia.FuelConsumption / 100; }
public static string OptimalVehicleCalculator(Tank checkTank, Warship checkWarship, Amfibia checkAmfibia) { if (checkTank.TotalFuelConsumption < checkWarship.TotalFuelConsumption && checkTank.TotalFuelConsumption < checkAmfibia.TotalFuelConsumption) { return($"\nTank is the optimal vehicle with {checkTank.TotalFuelConsumption}L used"); } if (checkWarship.TotalFuelConsumption < checkAmfibia.TotalFuelConsumption) { return($"\nWarship is the optimal vehicle with {checkWarship.TotalFuelConsumption}L used"); } return($"\nAmfibia is the optimal vehicle with {checkAmfibia.TotalFuelConsumption}L used"); }