}
return highestStation;
}
+
+ /**
+ * 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 getHighestAccumulatedWorth() throws NoSuchFuelTypeError {
+ float highestWorth = fuelStations[0].get_cumulative_retail_price();
+ FuelStation highestStation = fuelStations[0];
+ for (FuelStation fuelStation : fuelStations) {
+ if (fuelStation.get_cumulative_retail_price() > highestWorth) {
+ highestWorth = fuelStation.get_cumulative_retail_price();
+ highestStation = fuelStation;
+ }
+ }
+ return highestStation;
+ }
}
\ No newline at end of file