Merge remote-tracking branch 'origin/master'
This commit is contained in:
@@ -4,4 +4,8 @@
|
||||
* @author Gubitz, Wöstemeyer, Pfannenstiel, Maier, Vigier :D
|
||||
*/
|
||||
public class EinkommenInfo {
|
||||
public void main(String[]args){
|
||||
System.out.println("Übersicht über Bevölkerungszahl und Einkommen in Deutschland");
|
||||
System.out.println("");
|
||||
}
|
||||
}
|
||||
|
@@ -6,8 +6,57 @@
|
||||
* abgeleitete Eigenschaft und wird dementsprechend in der Methode 'getAnzahlEinwohner'
|
||||
* berechnet.
|
||||
*
|
||||
* @author Gubitz, Wöstemeyer, Pfannenstiel, Maier, Vigier :D
|
||||
* @author Vigier
|
||||
*/
|
||||
public class Gebiet {
|
||||
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 getSchüssel() {
|
||||
return schlüssel;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getName() {
|
||||
return name;
|
||||
}
|
||||
|
||||
@Override
|
||||
public long getGesamtEinkommen() {
|
||||
if(gesamtEinkommen == 0){
|
||||
return -1;
|
||||
|
||||
}
|
||||
return gesamtEinkommen;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getDurchschnittsEinkommen() {
|
||||
if(getDurchschnittsEinkommen() == 0){
|
||||
return -1;
|
||||
}
|
||||
return durchschnittsEinkommen;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getAnzahlEinwohner() {
|
||||
return (int) (gesamtEinkommen / durchschnittsEinkommen);
|
||||
}
|
||||
}
|
@@ -1,3 +1,6 @@
|
||||
/**
|
||||
* @author Vigier
|
||||
*/
|
||||
public interface GebietInterface {
|
||||
int getjahr();
|
||||
int getSchüssel();
|
||||
|
@@ -1,4 +1,4 @@
|
||||
public class GebietsMoc implements GebietInterface{
|
||||
public class GebietMock implements GebietInterface{
|
||||
|
||||
@Override
|
||||
public int getjahr() {
|
@@ -1,3 +1,7 @@
|
||||
import java.io.IOException;
|
||||
import java.nio.file.Files;
|
||||
import java.nio.file.Path;
|
||||
import java.nio.file.Paths;
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
@@ -6,13 +10,30 @@ import java.util.List;
|
||||
* interpretieren, als Gebiet-Objekte zu speichern und diese in Form einer Liste zur Verfügung
|
||||
* zu stellen.
|
||||
*
|
||||
* @author Gubitz, Wöstemeyer, Pfannenstiel, Maier, Vigier
|
||||
* @author Düsterhaus, Gubitz, Pfannenstiel, Maier, Vigier, Wöstemeyer
|
||||
*/
|
||||
public class GebietsDatei implements GebietsQuelle{
|
||||
private ArrayList<Gebiet> gebiete = new ArrayList<>();
|
||||
|
||||
public void GebietsDatei (String dateiname){
|
||||
Path pfad = Paths.get(dateiname);
|
||||
|
||||
try {
|
||||
List<String> zeilen = Files.readAllLines(pfad);
|
||||
|
||||
for(String zeile : zeilen) {
|
||||
String[] teile = zeile.split(";");
|
||||
int jahr = Integer.parseInt(teile[0]);
|
||||
int schlüssel = Integer.parseInt(teile[1]);
|
||||
String region = teile[2];
|
||||
int einkommenProHaushalt = Integer.parseInt(teile[3]);
|
||||
int einkommenjeEinwohner = Integer.parseInt(teile[4]);
|
||||
gebiete.add(new Gebiet(jahr, schlüssel, region, einkommenProHaushalt, einkommenjeEinwohner));
|
||||
}
|
||||
|
||||
} catch (IOException e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
}
|
||||
|
||||
public List<Gebiet> getGebiete() {
|
||||
|
@@ -1,6 +1,12 @@
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* Interface der Klasse GebietsDatei.
|
||||
*
|
||||
* @author Düsterhaus, Gubitz, Pfannenstiel, Maier, Vigier, Wöstemeyer
|
||||
*/
|
||||
|
||||
public interface GebietsQuelle {
|
||||
List<Gebiet> getGebiete();
|
||||
}
|
||||
|
@@ -1,3 +1,10 @@
|
||||
import java.util.List;
|
||||
|
||||
public interface ListenInterface
|
||||
{
|
||||
}
|
||||
Gebiet getGebietMinDurchschnittsEinkommen();
|
||||
Gebiet getGebietMaxAnzahlEinwohner();
|
||||
int getAnzahlGesamt();
|
||||
int getAnzahlUnvollständig();
|
||||
List<Gebiet> getGebieteNachNamen(String namensanfang);
|
||||
}
|
@@ -1,5 +1,14 @@
|
||||
import java.util.*;
|
||||
|
||||
/**
|
||||
* Mockklasse der Klasse GebietsDatei.
|
||||
* Die Klasse 'Gebietsdatei' hat die Aufgabe, die Datei 'Einkommen.csv' einzulesen, zu
|
||||
* interpretieren, als Gebiet-Objekte zu speichern und diese in Form einer Liste zur Verfügung
|
||||
* zu stellen.
|
||||
*
|
||||
* @author Düsterhaus, Gubitz, Pfannenstiel, Maier, Vigier, Wöstemeyer
|
||||
*/
|
||||
|
||||
public class MockGebietsDatei implements GebietsQuelle {
|
||||
private ArrayList<Gebiet> gebiete = new ArrayList<>();
|
||||
|
||||
|
Reference in New Issue
Block a user