From 5a5f86db98b3d88641f908da30cbc51583b5c86d Mon Sep 17 00:00:00 2001 From: Selim Eser <2211482@stud.hs-mannheim.de> Date: Sun, 9 Jun 2024 18:12:54 +0200 Subject: [PATCH] travel_time method implemented --- src/main/java/de/hs_mannheim/domain/System.java | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/src/main/java/de/hs_mannheim/domain/System.java b/src/main/java/de/hs_mannheim/domain/System.java index 897cf8e..d087e45 100644 --- a/src/main/java/de/hs_mannheim/domain/System.java +++ b/src/main/java/de/hs_mannheim/domain/System.java @@ -245,7 +245,12 @@ public class System { } public String[] travel_time(String destination_zip){ - return new String[1]; + + String[] result = new String[2]; + result[0] = "" + (Double.parseDouble(distance(destination_zip).replace(" km", "")) / current_user.getCar_avg_kmh()) + " h"; + result[1] = "" + (Double.parseDouble(distance(destination_zip).replace(" km", "")) / current_user.getBike_avg_kmh()) + " h"; + + return result; } public String calc_co2(String destination_zip){