Compare commits
No commits in common. "248eae539c0dc3ea7453c31796806f40aa45c0ad" and "0218fe81cb00d0f56d4389cba3c40e62a8269b03" have entirely different histories.
248eae539c
...
0218fe81cb
@ -1,72 +1,2 @@
|
|||||||
|
|
||||||
import java.sql.Array;
|
|
||||||
import java.util.*;
|
|
||||||
|
|
||||||
public class GebietsListe {
|
public class GebietsListe {
|
||||||
private List<Gebiet> gebiete;
|
|
||||||
|
|
||||||
public GebietsListe(List<Gebiet> gebiete) {
|
|
||||||
this.gebiete = gebiete;
|
|
||||||
}
|
|
||||||
|
|
||||||
public Gebiet getGebietMinDurchschnittsEinkommen(){
|
|
||||||
int gebietA = 0;
|
|
||||||
int gebietB = 0;
|
|
||||||
Gebiet gebietMitMinDurchschnittsEinkommen = null;
|
|
||||||
for (Gebiet g:gebiete) {
|
|
||||||
gebietA = g.getDurchschnittsEinkommen();
|
|
||||||
if (gebietA < gebietB) {
|
|
||||||
gebietMitMinDurchschnittsEinkommen = g;
|
|
||||||
gebietB = gebietA;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
if (gebietMitMinDurchschnittsEinkommen == null) {
|
|
||||||
System.err.println("Fehler bei der Suche nach dem geringsten Durchschnittseinkommen.");
|
|
||||||
}
|
|
||||||
return gebietMitMinDurchschnittsEinkommen;
|
|
||||||
}
|
|
||||||
|
|
||||||
public Gebiet getGebietMaxAnzahlEinwohner() {
|
|
||||||
int gebietA = 0;
|
|
||||||
int gebietB = 0;
|
|
||||||
Gebiet gebietMitMaxEinwohnern = null;
|
|
||||||
for (Gebiet g:gebiete) {
|
|
||||||
gebietA = g.getAnzahlEinwohner();
|
|
||||||
if (gebietA > gebietB)
|
|
||||||
{
|
|
||||||
gebietMitMaxEinwohnern = g;
|
|
||||||
gebietB = gebietA;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
if (gebietMitMaxEinwohnern == null)
|
|
||||||
{
|
|
||||||
System.err.println("Fehler bei der Suche nach den meisten Einwohnern .");
|
|
||||||
}
|
|
||||||
return gebietMitMaxEinwohnern;
|
|
||||||
}
|
|
||||||
|
|
||||||
public int getAnzahlGesamt()
|
|
||||||
{
|
|
||||||
return gebiete.size();
|
|
||||||
}
|
|
||||||
|
|
||||||
public int getAnzahlUnvollstaendig(){
|
|
||||||
int zaehler = 0;
|
|
||||||
for (Gebiet g:gebiete) {
|
|
||||||
if (g.getJahr() <= 0 || g.getSchlüssel() <= 0 || g.getName() == null || g.getGesamtEinkommen() <= 0 || g.getDurchschnittsEinkommen() <= 0) {
|
|
||||||
zaehler++;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
return zaehler;
|
|
||||||
}
|
|
||||||
|
|
||||||
public List<Gebiet> getGebieteNachNamen(String namensanfang) {
|
|
||||||
List<Gebiet> gebiete = new ArrayList<Gebiet>();
|
|
||||||
for (Gebiet g:gebiete) {
|
|
||||||
if (g.getName().contains(namensanfang)){
|
|
||||||
gebiete.add(g);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
return gebiete;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user