Nicht ganze Implementierung

WetterService
danai 2024-06-15 17:34:22 +02:00
parent cb15352cf3
commit 8540dc08e8
4 changed files with 189 additions and 18 deletions

View File

@ -0,0 +1,124 @@
<?xml version="1.0" encoding="UTF-8"?>
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
<modelVersion>4.0.0</modelVersion>
<groupId>hs-mannheim.de</groupId>
<artifactId>TravelBuddyApp</artifactId>
<version>0.0.1-SNAPSHOT</version>
<build>
<plugins>
<plugin>
<artifactId>maven-compiler-plugin</artifactId>
<version>3.8.1</version>
<configuration>
<source>${maven.compiler.source}</source>
<target>${maven.compiler.target}</target>
</configuration>
</plugin>
<plugin>
<artifactId>maven-shade-plugin</artifactId>
<version>3.2.4</version>
<executions>
<execution>
<phase>package</phase>
<goals>
<goal>shade</goal>
</goals>
<configuration>
<transformers>
<transformer>
<mainClass>de.hs_mannheim.informatik.mvn.Main</mainClass>
</transformer>
</transformers>
</configuration>
</execution>
</executions>
</plugin>
<plugin>
<groupId>org.jacoco</groupId>
<artifactId>jacoco-maven-plugin</artifactId>
<version>0.8.12</version>
<executions>
<execution>
<goals>
<goal>prepare-agent</goal>
</goals>
</execution>
<execution>
<id>report</id>
<phase>test</phase>
<goals>
<goal>report</goal>
</goals>
</execution>
</executions>
</plugin>
<plugin>
<artifactId>maven-pmd-plugin</artifactId>
<version>3.22.0</version>
<executions>
<execution>
<phase>verify</phase>
<goals>
<goal>check</goal>
</goals>
</execution>
</executions>
</plugin>
<plugin>
<groupId>org.owasp</groupId>
<artifactId>dependency-check-maven</artifactId>
<version>9.2.0</version>
<executions>
<execution>
<goals>
<goal>check</goal>
</goals>
</execution>
</executions>
</plugin>
</plugins>
</build>
<dependencies>
<dependency>
<groupId>org.junit.jupiter</groupId>
<artifactId>junit-jupiter-api</artifactId>
<version>5.8.1</version>
<scope>test</scope>
<exclusions>
<exclusion>
<artifactId>opentest4j</artifactId>
<groupId>org.opentest4j</groupId>
</exclusion>
<exclusion>
<artifactId>junit-platform-commons</artifactId>
<groupId>org.junit.platform</groupId>
</exclusion>
<exclusion>
<artifactId>apiguardian-api</artifactId>
<groupId>org.apiguardian</groupId>
</exclusion>
</exclusions>
</dependency>
<dependency>
<groupId>org.junit.jupiter</groupId>
<artifactId>junit-jupiter-engine</artifactId>
<version>5.8.1</version>
<scope>test</scope>
<exclusions>
<exclusion>
<artifactId>junit-platform-engine</artifactId>
<groupId>org.junit.platform</groupId>
</exclusion>
<exclusion>
<artifactId>apiguardian-api</artifactId>
<groupId>org.apiguardian</groupId>
</exclusion>
</exclusions>
</dependency>
</dependencies>
<properties>
<maven.compiler.target>21</maven.compiler.target>
<maven.compiler.source>21</maven.compiler.source>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
</properties>
</project>

View File

@ -5,11 +5,25 @@ public class Auto {
private String name;
private double co2AusstossProKm;
public Auto(String name, double co2AusstossProKm) {
this.name = name;
this.co2AusstossProKm = co2AusstossProKm;
}
public String getName() {
return name;
}
public void setName(String name) {
this.name = name;
}
public double getCO2AusstossProKm() {
return co2AusstossProKm;
}
public void setCO2AusstossProKm(double co2AusstossProKm) {
this.co2AusstossProKm = co2AusstossProKm;
}
}

View File

@ -1,20 +1,53 @@
package domain;
import java.io.IOException;
public class Ort {
private String plz;
private String name;
private String OrtName;
public Ort(String plz, String name) {
this.plz = plz;
this.name = name;
this.OrtName = name;
}
public String getPLZ() {
return plz;
}
public void setPLZ(String plz) {
this.plz = plz;
}
public String getOrtName() {
return OrtName;
}
public void setName(String name) {
this.OrtName = name;
}
@Override
public String toString() {
return OrtName + " (" + plz + ")";
}
public String getAktuellesWetter() {
try {
return WetterService.getAktuellesWetter(OrtName);
} catch (IOException | InterruptedException e) {
e.printStackTrace();
return "Fehler beim Abrufen des aktuellen Wetters";
}
}
public String getWettervorhersage() {
return "Wettervorhersage";
try {
return WetterService.getWettervorhersage(OrtName);
} catch (IOException | InterruptedException e) {
e.printStackTrace();
return "Fehler beim Abrufen der Wettervorhersage";
}
}
}

View File