random_destinations_bike method implemented

distance_related_methods
Selim Eser 2024-06-09 18:39:48 +02:00
parent 44b385bf3d
commit 9deda6bf76
1 changed files with 17 additions and 1 deletions

View File

@ -93,7 +93,23 @@ public class System {
} }
public ArrayList<String> random_destinations_bike(){ public ArrayList<String> random_destinations_bike(){
return new ArrayList<String>(); ArrayList<String> result = new ArrayList<>();
InputStream inputStream = Main.class.getResourceAsStream("/zip.csv");
try (BufferedReader reader = new BufferedReader(new InputStreamReader(inputStream))) {
String line;
while ((line = reader.readLine()) != null) {
line = line.replace("\"", "");
if(Double.parseDouble(distance(line.split(";")[0]).replace(" km", "")) < 100)
result.add(line);
}
} catch (Exception e) {}
return result;
} }
public String[] destination_details(String destination_zip){ public String[] destination_details(String destination_zip){