Zwischenstand
parent
1746ad7bb1
commit
91dcafc607
|
@ -36,5 +36,6 @@
|
||||||
<attribute name="maven.pomderived" value="true"/>
|
<attribute name="maven.pomderived" value="true"/>
|
||||||
</attributes>
|
</attributes>
|
||||||
</classpathentry>
|
</classpathentry>
|
||||||
|
<classpathentry kind="con" path="org.eclipse.jdt.junit.JUNIT_CONTAINER/4"/>
|
||||||
<classpathentry kind="output" path="target/classes"/>
|
<classpathentry kind="output" path="target/classes"/>
|
||||||
</classpath>
|
</classpath>
|
||||||
|
|
|
@ -80,17 +80,25 @@
|
||||||
</build>
|
</build>
|
||||||
<dependencies>
|
<dependencies>
|
||||||
<dependency>
|
<dependency>
|
||||||
<groupId>org.junit.jupiter</groupId>
|
<groupId>junit</groupId>
|
||||||
<artifactId>junit-jupiter-api</artifactId>
|
<artifactId>junit</artifactId>
|
||||||
<version>5.8.1</version>
|
<version>4.13.1</version>
|
||||||
<scope>test</scope>
|
<scope>test</scope>
|
||||||
<exclusions>
|
<exclusions>
|
||||||
<exclusion>
|
<exclusion>
|
||||||
<artifactId>opentest4j</artifactId>
|
<artifactId>hamcrest-core</artifactId>
|
||||||
<groupId>org.opentest4j</groupId>
|
<groupId>org.hamcrest</groupId>
|
||||||
</exclusion>
|
</exclusion>
|
||||||
|
</exclusions>
|
||||||
|
</dependency>
|
||||||
|
<dependency>
|
||||||
|
<groupId>org.junit.jupiter</groupId>
|
||||||
|
<artifactId>junit-jupiter-engine</artifactId>
|
||||||
|
<version>5.9.3</version>
|
||||||
|
<scope>test</scope>
|
||||||
|
<exclusions>
|
||||||
<exclusion>
|
<exclusion>
|
||||||
<artifactId>junit-platform-commons</artifactId>
|
<artifactId>junit-platform-engine</artifactId>
|
||||||
<groupId>org.junit.platform</groupId>
|
<groupId>org.junit.platform</groupId>
|
||||||
</exclusion>
|
</exclusion>
|
||||||
<exclusion>
|
<exclusion>
|
||||||
|
@ -101,13 +109,13 @@
|
||||||
</dependency>
|
</dependency>
|
||||||
<dependency>
|
<dependency>
|
||||||
<groupId>org.junit.jupiter</groupId>
|
<groupId>org.junit.jupiter</groupId>
|
||||||
<artifactId>junit-jupiter-engine</artifactId>
|
<artifactId>junit-jupiter-api</artifactId>
|
||||||
<version>5.8.1</version>
|
<version>5.9.3</version>
|
||||||
<scope>test</scope>
|
<scope>test</scope>
|
||||||
<exclusions>
|
<exclusions>
|
||||||
<exclusion>
|
<exclusion>
|
||||||
<artifactId>junit-platform-engine</artifactId>
|
<artifactId>opentest4j</artifactId>
|
||||||
<groupId>org.junit.platform</groupId>
|
<groupId>org.opentest4j</groupId>
|
||||||
</exclusion>
|
</exclusion>
|
||||||
<exclusion>
|
<exclusion>
|
||||||
<artifactId>apiguardian-api</artifactId>
|
<artifactId>apiguardian-api</artifactId>
|
||||||
|
@ -115,6 +123,18 @@
|
||||||
</exclusion>
|
</exclusion>
|
||||||
</exclusions>
|
</exclusions>
|
||||||
</dependency>
|
</dependency>
|
||||||
|
<dependency>
|
||||||
|
<groupId>org.junit.platform</groupId>
|
||||||
|
<artifactId>junit-platform-commons</artifactId>
|
||||||
|
<version>1.9.3</version>
|
||||||
|
<scope>test</scope>
|
||||||
|
<exclusions>
|
||||||
|
<exclusion>
|
||||||
|
<artifactId>apiguardian-api</artifactId>
|
||||||
|
<groupId>org.apiguardian</groupId>
|
||||||
|
</exclusion>
|
||||||
|
</exclusions>
|
||||||
|
</dependency>
|
||||||
</dependencies>
|
</dependencies>
|
||||||
<properties>
|
<properties>
|
||||||
<maven.compiler.target>21</maven.compiler.target>
|
<maven.compiler.target>21</maven.compiler.target>
|
||||||
|
|
|
@ -109,9 +109,6 @@ public class KurztripEmpfehlung {
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
private List<Ort> ladeAlleOrte() {
|
private List<Ort> ladeAlleOrte() {
|
||||||
List<Ort> alleOrte = new ArrayList<>();
|
List<Ort> alleOrte = new ArrayList<>();
|
||||||
|
|
||||||
|
|
|
@ -4,38 +4,46 @@ import java.io.IOException;
|
||||||
|
|
||||||
public class Ort {
|
public class Ort {
|
||||||
|
|
||||||
private String plz;
|
private int plz;
|
||||||
private String OrtName;
|
private String ortName;
|
||||||
|
private double breitengrad;
|
||||||
|
private double längengrad;
|
||||||
|
|
||||||
public Ort(String plz, String name) {
|
|
||||||
|
public Ort(int plz, String name) {
|
||||||
this.plz = plz;
|
this.plz = plz;
|
||||||
this.OrtName = name;
|
this.ortName = name;
|
||||||
}
|
}
|
||||||
|
|
||||||
public String getPLZ() {
|
|
||||||
|
public Ort(int plz, String name, double breitengrad, double längengrad) {
|
||||||
|
this.plz = plz;
|
||||||
|
this.ortName = name;
|
||||||
|
this.breitengrad = breitengrad;
|
||||||
|
this.längengrad = längengrad;
|
||||||
|
}
|
||||||
|
|
||||||
|
public int getPLZ() {
|
||||||
return plz;
|
return plz;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void setPLZ(String plz) {
|
|
||||||
this.plz = plz;
|
|
||||||
}
|
|
||||||
|
|
||||||
public String getOrtName() {
|
public String getOrtName() {
|
||||||
return OrtName;
|
return ortName;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void setName(String name) {
|
|
||||||
this.OrtName = name;
|
|
||||||
|
public double getBreitengrad() {
|
||||||
|
return breitengrad;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
public double getLängengrad() {
|
||||||
public String toString() {
|
return längengrad;
|
||||||
return OrtName + " (" + plz + ")";
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public String getAktuellesWetter() {
|
public String getAktuellesWetter() {
|
||||||
try {
|
try {
|
||||||
return WetterService.getAktuellesWetter(OrtName);
|
return WetterService.getAktuellesWetter(ortName);
|
||||||
} catch (IOException | InterruptedException e) {
|
} catch (IOException | InterruptedException e) {
|
||||||
e.printStackTrace();
|
e.printStackTrace();
|
||||||
return "Fehler beim Abrufen des aktuellen Wetters";
|
return "Fehler beim Abrufen des aktuellen Wetters";
|
||||||
|
@ -44,7 +52,7 @@ public class Ort {
|
||||||
|
|
||||||
public String getWettervorhersage() {
|
public String getWettervorhersage() {
|
||||||
try {
|
try {
|
||||||
return WetterService.getWettervorhersage(OrtName);
|
return WetterService.getWettervorhersage(ortName);
|
||||||
} catch (IOException | InterruptedException e) {
|
} catch (IOException | InterruptedException e) {
|
||||||
e.printStackTrace();
|
e.printStackTrace();
|
||||||
return "Fehler beim Abrufen der Wettervorhersage";
|
return "Fehler beim Abrufen der Wettervorhersage";
|
||||||
|
|
|
@ -92,25 +92,26 @@ public class User {
|
||||||
}
|
}
|
||||||
|
|
||||||
public boolean einloggen() {
|
public boolean einloggen() {
|
||||||
|
try (BufferedReader reader = new BufferedReader(new FileReader("users.txt"))) {
|
||||||
try (BufferedReader reader = new BufferedReader(new FileReader("users.txt"))) {
|
String line;
|
||||||
String line;
|
while ((line = reader.readLine()) != null) {
|
||||||
while ((line = reader.readLine()) != null) {
|
String[] parts = line.split(",");
|
||||||
String[] parts = line.split(",");
|
if (parts[0].equals(username) && parts[1].equals(hashedPassword)) {
|
||||||
if (parts[0].equals(username) && parts[1].equals(hashedPassword)) {
|
int plz = Integer.parseInt(parts[2]);
|
||||||
this.heimatstandort = new Ort(parts[2], parts[3]);
|
this.heimatstandort = new Ort(plz, parts[3]);
|
||||||
this.auto = new Auto(parts[4], Double.parseDouble(parts[5]));
|
this.auto = new Auto(parts[4], Double.parseDouble(parts[5]));
|
||||||
this.durchschnittsgeschwindigkeitPKW = Double.parseDouble(parts[6]);
|
this.durchschnittsgeschwindigkeitPKW = Double.parseDouble(parts[6]);
|
||||||
this.durchschnittsgeschwindigkeitFahrrad = Double.parseDouble(parts[7]);
|
this.durchschnittsgeschwindigkeitFahrrad = Double.parseDouble(parts[7]);
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
} catch (IOException e) {
|
} catch (IOException e) {
|
||||||
e.printStackTrace();
|
e.printStackTrace();
|
||||||
}
|
}
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
public String zeigeWetterHeimatstandort() {
|
public String zeigeWetterHeimatstandort() {
|
||||||
try {
|
try {
|
||||||
return WetterService.getAktuellesWetter(heimatstandort.getOrtName());
|
return WetterService.getAktuellesWetter(heimatstandort.getOrtName());
|
||||||
|
|
|
@ -35,6 +35,7 @@ public class ReiseFassade {
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
public double berechneEntfernung() {
|
public double berechneEntfernung() {
|
||||||
return reiseplanung.getEntfernung();
|
return reiseplanung.getEntfernung();
|
||||||
}
|
}
|
||||||
|
|
|
@ -6,7 +6,7 @@ import domain.Auto;
|
||||||
|
|
||||||
public class UserFassade {
|
public class UserFassade {
|
||||||
|
|
||||||
public User registrieren(String username, String password, String plz, String ortName, String autoName,
|
public User registrieren(String username, String password, int plz, String ortName, String autoName,
|
||||||
double co2AusstossProKm, double durchschnittsgeschwindigkeitPKW,
|
double co2AusstossProKm, double durchschnittsgeschwindigkeitPKW,
|
||||||
double durchschnittsgeschwindigkeitFahrrad) {
|
double durchschnittsgeschwindigkeitFahrrad) {
|
||||||
Ort heimatstandort = new Ort(plz, ortName);
|
Ort heimatstandort = new Ort(plz, ortName);
|
||||||
|
|
|
@ -175,7 +175,7 @@ public class UserInterface {
|
||||||
|
|
||||||
switch (transportmittel) {
|
switch (transportmittel) {
|
||||||
case "fahrrad":
|
case "fahrrad":
|
||||||
List<Ort> fahrradOrte = reiseFacade.zufallsorteFahrrad(100);
|
List<Ort> fahrradOrte = reiseFacade.zufallsorteFahrrad(10000);
|
||||||
if (fahrradOrte.isEmpty()) {
|
if (fahrradOrte.isEmpty()) {
|
||||||
System.out.println("Keine Orte innerhalb von 100 km gefunden.");
|
System.out.println("Keine Orte innerhalb von 100 km gefunden.");
|
||||||
} else {
|
} else {
|
||||||
|
@ -205,6 +205,8 @@ public class UserInterface {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
public static void main(String[] args) {
|
public static void main(String[] args) {
|
||||||
new UserInterface();
|
new UserInterface();
|
||||||
|
|
||||||
|
|
|
@ -1,4 +0,0 @@
|
||||||
|
|
||||||
public class UserTest {
|
|
||||||
|
|
||||||
}
|
|
|
@ -0,0 +1,3 @@
|
||||||
|
dana,a665a45920422f9d417e4867efdc4fb8a04a1f3fff1fa07e998e86f7f7a27ae3,67105,Schifferstadt,audi,123.0,60.0,30.0
|
||||||
|
max,a665a45920422f9d417e4867efdc4fb8a04a1f3fff1fa07e998e86f7f7a27ae3,555,berlin,audi,12.0,23.0,34.0
|
||||||
|
tina,a665a45920422f9d417e4867efdc4fb8a04a1f3fff1fa07e998e86f7f7a27ae3,1328,Dresden,audi,12.0,34.0,56.0
|
Loading…
Reference in New Issue