diff --git a/src/main/java/de/hs_mannheim/domain/System.java b/src/main/java/de/hs_mannheim/domain/System.java index d087e45..aace573 100644 --- a/src/main/java/de/hs_mannheim/domain/System.java +++ b/src/main/java/de/hs_mannheim/domain/System.java @@ -253,8 +253,10 @@ public class System { return result; } - public String calc_co2(String destination_zip){ - return ""; + public String calc_l_consumption(String destination_zip){ + + return "" + (Double.parseDouble(distance(destination_zip).replace(" km", "")) * (current_user.getCar_l_100km() / 100)) + " l"; + } } diff --git a/src/main/java/de/hs_mannheim/domain/User.java b/src/main/java/de/hs_mannheim/domain/User.java index b0cd545..54eacac 100644 --- a/src/main/java/de/hs_mannheim/domain/User.java +++ b/src/main/java/de/hs_mannheim/domain/User.java @@ -7,7 +7,7 @@ public class User { private String hometown = ""; private int zip; private String car_name = ""; - private double car_co2_kmh; + private double car_l_100km; private double car_avg_kmh; private double bike_avg_kmh; @@ -51,14 +51,14 @@ public class User { this.car_name = car_name; } - public double getCar_co2_kmh() { - return car_co2_kmh; + public double getCar_l_100km() { + return car_l_100km; } - public void setCar_co2_kmh(double car_co2_kmh) { - this.car_co2_kmh = car_co2_kmh; + public void setCar_l_100km(double car_l_100km) { + this.car_l_100km = car_l_100km; } - + public double getCar_avg_kmh() { return car_avg_kmh; }