Compare commits

..

1 Commits

Author SHA1 Message Date
Oliver Hummel 3c8c557262 Experimentelle Sortierung der Kontenliste 2022-11-29 14:07:07 +01:00
9 changed files with 20 additions and 35 deletions

View File

@ -1,5 +0,0 @@
package de.hs_mannheim.informatik.bank.domain;
public class Aktie {
}

View File

@ -2,6 +2,7 @@ package de.hs_mannheim.informatik.bank.domain;
import java.io.Serializable;
import java.util.Collection;
import java.util.Collections;
import java.util.HashMap;
public class Bank implements Serializable {

View File

@ -1,5 +0,0 @@
package de.hs_mannheim.informatik.bank.domain;
public class Depot extends Geldanlage {
}

View File

@ -1,7 +0,0 @@
package de.hs_mannheim.informatik.bank.domain;
public class Geldanlage {
private Kunde inhaber;
}

View File

@ -3,7 +3,7 @@ package de.hs_mannheim.informatik.bank.domain;
import java.io.Serializable;
import java.util.ArrayList;
public class Konto extends Geldanlage implements Serializable {
public class Konto implements Serializable, Comparable {
private int nummer;
protected long stand = 0;
private String inhaber;
@ -23,7 +23,7 @@ public class Konto extends Geldanlage implements Serializable {
@Override
public String toString() {
return "Konto [nummer=" + nummer + ", inhaber=" + inhaber + "]";
return "Konto "+ stand + "[nummer=" + nummer + ", inhaber=" + inhaber + "]";
}
public String getInhaber() {
@ -73,4 +73,12 @@ public class Konto extends Geldanlage implements Serializable {
return saldo;
}
@Override
public int compareTo(Object other) {
Konto kOther = (Konto) other;
// return (int) (this.stand - kOther.stand);
return this.inhaber.compareTo(kOther.inhaber);
}
}

View File

@ -1,5 +0,0 @@
package de.hs_mannheim.informatik.bank.domain;
public class Kunde {
}

View File

@ -1,6 +1,9 @@
package de.hs_mannheim.informatik.bank.facade;
import java.util.ArrayList;
import java.util.Collection;
import java.util.Collections;
import java.util.TreeSet;
import de.hs_mannheim.informatik.bank.domain.Bank;
import de.hs_mannheim.informatik.bank.domain.Girokonto;
@ -27,10 +30,15 @@ public class Banksystem {
public String[] getKontenliste() {
Collection<Konto> konten = bank.getKontenliste();
TreeSet<Konto> ts = new TreeSet<>(konten);
String[] liste = new String[konten.size()];
int i = 0;
for (Konto k : konten) {
for (Konto k : ts) {
liste[i++] = k.toString();
}

View File

@ -1,5 +0,0 @@
package gui;
public class Eventhandler {
}

View File

@ -1,5 +0,0 @@
package gui;
public class Gui {
}