forked from hummel/Bank-System
Kunden können angezeigt werden
parent
6afb9a1a1b
commit
2285250d6d
|
@ -60,4 +60,8 @@ public class Bank implements Serializable {
|
|||
Konto k = konten.get(kontonummer);
|
||||
k.setKunde(ku);
|
||||
}
|
||||
|
||||
public Collection<Kunde> getKundenListe() {
|
||||
return kunden.values();
|
||||
}
|
||||
}
|
||||
|
|
|
@ -27,6 +27,10 @@ public class Kunde {
|
|||
return this.id;
|
||||
}
|
||||
|
||||
public ArrayList<Konto> getKonten() {
|
||||
return konten;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
return "Vorname: " + this.vorname + " Name: " + this.name +" Alter: " + this.alter + " Wohnort: "+ this.wohnort;
|
||||
|
|
|
@ -6,6 +6,7 @@ import java.util.Collection;
|
|||
import de.hs_mannheim.informatik.bank.domain.Bank;
|
||||
import de.hs_mannheim.informatik.bank.domain.Girokonto;
|
||||
import de.hs_mannheim.informatik.bank.domain.Konto;
|
||||
import de.hs_mannheim.informatik.bank.domain.Kunde;
|
||||
import de.hs_mannheim.informatik.bank.infrastructure.Persistenz;
|
||||
|
||||
public class Banksystem {
|
||||
|
@ -101,4 +102,15 @@ public class Banksystem {
|
|||
bank.kundeAnlegen( vorname, name, alter, wh);
|
||||
}
|
||||
|
||||
public String[] getKundenListe() {
|
||||
Collection<Kunde> kunden = bank.getKundenListe();
|
||||
String[] liste = new String[kunden.size()];
|
||||
|
||||
int i = 0;
|
||||
for (Kunde k : kunden) {
|
||||
liste[i++] = k.toString();
|
||||
}
|
||||
|
||||
return liste;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -28,7 +28,8 @@ public class UI {
|
|||
System.out.println("6 -> Überweisung beauftragen");
|
||||
System.out.println("7 -> Saldo abfragen");
|
||||
System.out.println("8 -> Neuer Kunde");
|
||||
System.out.println("9 -> Beenden");
|
||||
System.out.println("9 -> Alle Kunden anzeigen");
|
||||
System.out.println("12 -> Beenden");
|
||||
System.out.println();
|
||||
|
||||
System.out.print("> ");
|
||||
|
@ -62,6 +63,9 @@ public class UI {
|
|||
neuerKunde();
|
||||
break;
|
||||
case 9:
|
||||
kundenAnzeigen();
|
||||
break;
|
||||
case 12:
|
||||
break mainloop;
|
||||
}
|
||||
|
||||
|
@ -75,6 +79,18 @@ public class UI {
|
|||
|
||||
} // hauptmenü
|
||||
|
||||
private void kundenAnzeigen() {
|
||||
String[] kunden = bs.getKundenListe();
|
||||
if (kunden.length > 0) {
|
||||
System.out.println("Folgende Kunden sind aktuell verfügbar:");
|
||||
for (String s : kunden) {
|
||||
System.out.println(s);
|
||||
}
|
||||
} else {
|
||||
System.out.println("Bisher keine Kunden angelegt.");
|
||||
}
|
||||
}
|
||||
|
||||
private void neuerKunde() {
|
||||
System.out.println("Bitte geben sie ihren Vornamen ein");
|
||||
String vorname = sc.nextLine();
|
||||
|
@ -121,7 +137,8 @@ public class UI {
|
|||
// optional prüfen, ob Konto existiert
|
||||
|
||||
System.out.print("Bitte den gewünschten Betrag eingeben: ");
|
||||
double betrag = returnUserInputDouble();;
|
||||
double betrag = returnUserInputDouble();
|
||||
;
|
||||
|
||||
long neuerKontostand = bs.geldEinzahlen(kontonummer, (long) (betrag * 100));
|
||||
|
||||
|
|
Loading…
Reference in New Issue