Compare commits
7 Commits
9c14f86b00
...
readfile
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
a1827ac6a4 | ||
| f9bc2db7bb | |||
| 044d274da5 | |||
| 6fb0c50f62 | |||
| 8fd4bc6d32 | |||
| 57d88900ce | |||
| 266c4b2b4d |
46
src/Gebiet.java
Normal file
46
src/Gebiet.java
Normal file
@@ -0,0 +1,46 @@
|
||||
|
||||
public class Gebiet implements GebietInterface{
|
||||
private int jahr;
|
||||
private int schlüssel;
|
||||
private String name;
|
||||
private long gesamtEinkommen;
|
||||
private int durchschnittsEinkommen;
|
||||
|
||||
public Gebiet(int jahr, int schlüssel, String name, long gesamtEinkommen, int durchschnittsEinkommen) {
|
||||
this.jahr = jahr;
|
||||
this.schlüssel = schlüssel;
|
||||
this.name = name;
|
||||
this.gesamtEinkommen = gesamtEinkommen;
|
||||
this.durchschnittsEinkommen = durchschnittsEinkommen;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getJahr() {
|
||||
return jahr;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getSchlüssel() {
|
||||
return schlüssel;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getName() {
|
||||
return name;
|
||||
}
|
||||
|
||||
@Override
|
||||
public long getGesamtEinkommen() {
|
||||
return gesamtEinkommen;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getDurchschnittsEinkommen() {
|
||||
return durchschnittsEinkommen;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getAnzahlEinwohner() {
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
39
src/GebietMock.java
Normal file
39
src/GebietMock.java
Normal file
@@ -0,0 +1,39 @@
|
||||
public class GebietMock implements GebietInterface{
|
||||
public GebietMock() {
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getJahr() {
|
||||
return 0;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getSchlüssel() {
|
||||
return 0;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getName() {
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public long getGesamtEinkommen() {
|
||||
return 0;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getDurchschnittsEinkommen() {
|
||||
return 0;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getAnzahlEinwohner() {
|
||||
return 0;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
return "GebietMock{}";
|
||||
}
|
||||
}
|
||||
25
src/GebietsDatei.java
Normal file
25
src/GebietsDatei.java
Normal file
@@ -0,0 +1,25 @@
|
||||
import java.nio.file.Files;
|
||||
import java.nio.file.Paths;
|
||||
import java.util.ArrayList;
|
||||
|
||||
public class GebietsDatei {
|
||||
|
||||
private String dateiName;
|
||||
|
||||
public GebietsDatei(String dateiName) {
|
||||
this.dateiName = dateiName;
|
||||
}
|
||||
|
||||
public ArrayList<Gebiet> getGebiete() {
|
||||
ArrayList<Gebiet> gebiete = new ArrayList<>();
|
||||
try {
|
||||
Files.readAllLines(Paths.get(dateiName)).forEach(line -> {
|
||||
String[] parts = line.split(";");
|
||||
gebiete.add(new Gebiet(Integer.parseInt(parts[0]), Integer.parseInt(parts[1]), parts[2], Long.parseLong(parts[3]), Integer.parseInt(parts[4])));
|
||||
});
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
return gebiete;
|
||||
}
|
||||
}
|
||||
3
src/GebietsListe.java
Normal file
3
src/GebietsListe.java
Normal file
@@ -0,0 +1,3 @@
|
||||
public class GebietsListe {
|
||||
|
||||
}
|
||||
Reference in New Issue
Block a user