Changed car_co2_km to car_l_100km because its more important for user and implemented calc_l_consumption

distance_related_methods
Selim Eser 2024-06-09 18:25:57 +02:00
parent 5a5f86db98
commit 5413a18435
2 changed files with 10 additions and 8 deletions

View File

@ -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";
}
}

View File

@ -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,12 +51,12 @@ 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() {