Compare commits
6 Commits
c7defb02a6
...
master
Author | SHA1 | Date | |
---|---|---|---|
cd1ec136a9 | |||
ea7a52dcb3 | |||
0facc68e7e | |||
e7c5ec3963 | |||
14e15a68ce | |||
19214584c3 |
@@ -26,12 +26,36 @@ public class GebietListe implements ListenInterface
|
||||
|
||||
public Gebiet getGebietMinDurchschnittsEinkommen()
|
||||
{
|
||||
|
||||
int einkommen1 = 0;
|
||||
int minDurchschnitt = 0;
|
||||
Gebiet g = null;
|
||||
for (Gebiet gebiet : gebiete)
|
||||
{
|
||||
einkommen1 = gebiet.getDurchschnittsEinkommen();
|
||||
if (einkommen1 < minDurchschnitt)
|
||||
{
|
||||
minDurchschnitt = einkommen1;
|
||||
g = gebiet;
|
||||
}
|
||||
}
|
||||
return g;
|
||||
}
|
||||
|
||||
public Gebiet getGebietMaxAnzahlEinwohner()
|
||||
{
|
||||
|
||||
int einwohner = 0;
|
||||
int maxEinwohner = 0;
|
||||
Gebiet e = null;
|
||||
for (Gebiet gebiet : gebiete)
|
||||
{
|
||||
einwohner = gebiet.getAnzahlEinwohner();
|
||||
if (einwohner > maxEinwohner)
|
||||
{
|
||||
maxEinwohner = einwohner;
|
||||
e = gebiet;
|
||||
}
|
||||
}
|
||||
return e;
|
||||
}
|
||||
|
||||
public int getAnzahlGesamt()
|
||||
@@ -48,6 +72,4 @@ public class GebietListe implements ListenInterface
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
@@ -15,7 +15,7 @@ import java.util.List;
|
||||
public class GebietsDatei implements GebietsQuelle{
|
||||
private ArrayList<Gebiet> gebiete = new ArrayList<>();
|
||||
|
||||
public void GebietsDatei (String dateiname){
|
||||
public GebietsDatei (String dateiname){
|
||||
Path pfad = Paths.get(dateiname);
|
||||
|
||||
try {
|
||||
|
@@ -1,4 +1,3 @@
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
|
@@ -1,4 +1,14 @@
|
||||
public class MockGebietListe
|
||||
{
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
public class MockGebietListe implements ListenInterface
|
||||
{
|
||||
private ArrayList<Gebiet> gebiete = new ArrayList<>();
|
||||
|
||||
public void GebietsListe(List<Gebiet> gebiete){ }
|
||||
public Gebiet getGebietMinDurchschnittsEinkommen() {return null;}
|
||||
public Gebiet getGebietMaxAnzahlEinwohner() {return null;}
|
||||
public int getAnzahlGesamt() {return 0;}
|
||||
public int getAnzahlUnvollständig() {return 0;}
|
||||
public List<Gebiet> getGebieteNachNamen(String namensanfang) {return gebiete;}
|
||||
}
|
||||
|
Reference in New Issue
Block a user