This commit is contained in:
Mykola Fesenko
2025-07-29 08:08:23 +02:00
commit 899a05907b
355 changed files with 11002 additions and 0 deletions

114
14/12/Bank.~ava Normal file
View File

@@ -0,0 +1,114 @@
import java.util.Scanner;
import java.util.ArrayList;
public class Bank {
public static void main(String[] args) {
showBar();
Kunde kunde = new Kunde("Meier", 23);
// ArrayList<Girokonto> konten = new ArrayList();
//
// konten.add( new Girokonto(0,1000.0));
// konten.add( new Girokonto(1,100430.0));
// konten.add( new Girokonto(2,53.3));
kunde.setKundeKonto(new Girokonto(0,1000.0),0);
kunde.setKundeKonto(new Girokonto(1,10340.0),1);
kunde.setKundeKonto(new Girokonto(2,15.0),2);
for (int i = 0; i < kunde.getKundeKonto().size(); i++) {
System.out.println(kunde.getKundeKonto(i).getKontonr());
System.out.println(kunde.getKundeKonto(i).getKontostand());
showBar();
} // end of for
Scanner input = new Scanner(System.in);
String nl = System.lineSeparator();
boolean end = false;
int index = 0;
while(!end) {
System.out.println("Was wollen Sie?");
System.out.println("1. Übersicht \n2. Anzahl\n3. Konto wählen\n0. Beenden");
System.out.println();
System.out.print("Wahl: ");
String wahl = input.next();
System.out.println();
switch (wahl) {
case "1":
kunde.uebersichtKonten();
break;
case "2":
kunde.anzahlKonten();
break;
case "3":
System.out.println("Wählen Sie Konto!");
System.out.print("Index: ");
index = input.nextInt();
KontoMenu(kunde.getKundeKonto(index));
break;
case "0":
end = true;
break;
}
System.out.println("----------------------------");
}
System.out.println("Auf Wiedersehen!");
}
public static void KontoMenu(Konto konto) {
Scanner input = new Scanner(System.in);
String nl = System.lineSeparator();
boolean end = false;
double summe = 0;
while(!end) {
System.out.println("Was wollen Sie?");
System.out.println("1. Kontostand anzeigen \n2. Einzahlen\n3. Auszahlen\n0. Beenden");
System.out.println();
System.out.print("Wahl: ");
String wahl = input.next();
System.out.println();
switch (wahl) {
case "1":
System.out.println("Ihre Kontostand: " + konto.getKontostand() );
break;
case "2":
System.out.println("Einzahlung!");
System.out.print("Tragen Sie die Summe: ");
summe = input.nextDouble();
konto.einzahlen(summe);
break;
case "3":
System.out.println("Auszahlung!");
System.out.print("Tragen Sie die Summe: ");
summe = input.nextDouble();
konto.auszahlen(summe);
break;
case "0":
end = true;
break;
}
showBar();
}
System.out.println("Auf Wiedersehen!");
showBar();
showBar();
showBar();
}
public static void showBar() {
System.out.println("----------------------------");
}
}