import java.util.ArrayList;
+import de.diejungsvondertanke.tankstelle.error.NoSuchFuelTypeError;
+
/**
* Main Class
*/
}
return result.toArray(new FuelStation[0]); // Change to LargeFuelStation if required
}
+ /**
+ * Get the FuelStation with the highest price
+ *
+ *
+ * @param fuelType Select the type of fuel
+ *
+ * @return a FuelStation (all of type {@link FuelStation})
+ */
+ public static FuelStation getHighestPrise (FuelType fuelType) throws NoSuchFuelTypeError {
+ float highestPrice = fuelStations[0].get_price(fuelType);
+ FuelStation HighestStation = fuelStations[0];
+ for (FuelStation fuelStation : fuelStations) {
+ if (fuelStation.get_price(fuelType) > highestPrice){
+ highestPrice = fuelStation.get_price(fuelType);
+ HighestStation = fuelStation;
+ }
+ }
+ return HighestStation;
+ }
}
\ No newline at end of file