[ADD] constructors

This commit is contained in:
Sem van der Hoeven
2020-12-14 11:16:40 +01:00
parent dec62e8b9a
commit 64c8b0591a
3 changed files with 27 additions and 6 deletions

View File

@@ -5,6 +5,11 @@ public class Coupon {
private String code;
private String reward;
public Coupon(String code, String reward) {
this.code = code;
this.reward = reward;
}
public String getCode() {
return code;
}

View File

@@ -1,4 +1,12 @@
package com.a1.nextlocation.data;
public class FileIO {
public static void readFileData() {
}
public static void writeFileData() {
}
}

View File

@@ -1,5 +1,6 @@
package com.a1.nextlocation.data;
import java.util.ArrayList;
import java.util.List;
public class Route {
@@ -8,6 +9,17 @@ public class Route {
private float totalDistance;
private int totalTime;
public Route(String name) {
this.name = name;
this.locations = new ArrayList<>();
}
public void addLocation(Location location) {
this.locations.add(location);
}
public String getName() {
return name;
}
@@ -25,18 +37,14 @@ public class Route {
}
public float getTotalDistance() {
//TODO calculate total distance according to all locations in list
return totalDistance;
}
public void setTotalDistance(float totalDistance) {
this.totalDistance = totalDistance;
}
public int getTotalTime() {
//TODO calculate total time according to all locations in list
return totalTime;
}
public void setTotalTime(int totalTime) {
this.totalTime = totalTime;
}
}