diff --git a/.idea/uiDesigner.xml b/.idea/uiDesigner.xml
new file mode 100644
index 0000000..2b63946
--- /dev/null
+++ b/.idea/uiDesigner.xml
@@ -0,0 +1,124 @@
+
+
+
+
+ -
+
+
+ -
+
+
+ -
+
+
+ -
+
+
+ -
+
+
+
+
+
+ -
+
+
+
+
+
+ -
+
+
+
+
+
+ -
+
+
+
+
+
+ -
+
+
+
+
+ -
+
+
+
+
+ -
+
+
+
+
+ -
+
+
+
+
+ -
+
+
+
+
+ -
+
+
+
+
+ -
+
+
+ -
+
+
+
+
+ -
+
+
+
+
+ -
+
+
+
+
+ -
+
+
+
+
+ -
+
+
+
+
+ -
+
+
+ -
+
+
+ -
+
+
+ -
+
+
+ -
+
+
+
+
+ -
+
+
+ -
+
+
+
+
+
\ No newline at end of file
diff --git a/.idea/vcs.xml b/.idea/vcs.xml
index 4c6280e..94a25f7 100644
--- a/.idea/vcs.xml
+++ b/.idea/vcs.xml
@@ -1,11 +1,5 @@
-
-
-
-
-
-
diff --git a/.idea/workspace.xml b/.idea/workspace.xml
index 56276b5..1eef80e 100644
--- a/.idea/workspace.xml
+++ b/.idea/workspace.xml
@@ -5,19 +5,50 @@
-
-
-
-
-
-
-
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
@@ -25,7 +56,9 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
@@ -54,7 +107,8 @@
1727259661745
-
+
+
@@ -72,17 +126,6 @@
-
-
-
-
- file://$PROJECT_DIR$/src/main/java/de/deversmann/Main.java
- 13
-
-
-
-
-
diff --git a/src/main/java/de/deversmann/BankApp.java b/src/main/java/de/deversmann/BankApp.java
new file mode 100644
index 0000000..c4dcfb6
--- /dev/null
+++ b/src/main/java/de/deversmann/BankApp.java
@@ -0,0 +1,41 @@
+package de.deversmann;
+
+import de.deversmann.Facade.BankFacade;
+import de.deversmann.UI.BankUI;
+
+public class BankApp {
+ public static void main(String[] args) {
+ BankFacade bankFacade = new BankFacade();
+ BankUI bankUI = new BankUI(); // Instanz der UI-Klasse
+
+ System.out.println("Willkommen bei der BankApp!");
+
+ try {
+ String accountNumber = bankUI.getAccountNumber();
+ int action = bankUI.getAction();
+
+ switch (action) {
+ case 1:
+ double depositAmount = bankUI.getDepositAmount();
+ bankFacade.depositToAccount(accountNumber, depositAmount);
+ bankUI.showSuccessMessage("Einzahlung erfolgreich.");
+ break;
+ case 2:
+ double withdrawAmount = bankUI.getWithdrawAmount();
+ bankFacade.withdrawFromAccount(accountNumber, withdrawAmount);
+ bankUI.showSuccessMessage("Abhebung erfolgreich.");
+ break;
+ case 3:
+ double balance = bankFacade.getAccountBalance(accountNumber);
+ bankUI.showBalance(balance);
+ break;
+ default:
+ bankUI.showErrorMessage("Ungültige Aktion.");
+ }
+ } catch (Exception e) {
+ bankUI.showErrorMessage(e.getMessage());
+ } finally {
+ bankUI.closeScanner(); // Scanner wird geschlossen
+ }
+ }
+}
\ No newline at end of file
diff --git a/src/main/java/de/deversmann/Domain/Account.java b/src/main/java/de/deversmann/Domain/Account.java
new file mode 100644
index 0000000..abb9f91
--- /dev/null
+++ b/src/main/java/de/deversmann/Domain/Account.java
@@ -0,0 +1,29 @@
+package de.deversmann.Domain;
+
+public class Account {
+ private String accountNumber;
+ private double balance;
+
+ public Account(String accountNumber, double initialBalance) {
+ this.accountNumber = accountNumber;
+ this.balance = initialBalance;
+ }
+
+ public void deposit(double amount) {
+ if (amount > 0) {
+ balance += amount;
+ }
+ }
+
+ public void withdraw(double amount) throws Exception {
+ if (amount > 0 && balance >= amount) {
+ balance -= amount;
+ } else {
+ throw new Exception("Insufficient balance");
+ }
+ }
+
+ public double getBalance() {
+ return balance;
+ }
+}
\ No newline at end of file
diff --git a/src/main/java/de/deversmann/Facade/BankFacade.java b/src/main/java/de/deversmann/Facade/BankFacade.java
new file mode 100644
index 0000000..f1fc6b2
--- /dev/null
+++ b/src/main/java/de/deversmann/Facade/BankFacade.java
@@ -0,0 +1,43 @@
+package de.deversmann.Facade;
+
+import de.deversmann.Domain.Account;
+
+import java.util.HashMap;
+import java.util.Map;
+
+public class BankFacade {
+ private Map accounts;
+
+ public BankFacade() {
+ this.accounts = new HashMap<>();
+ // Beispiel: Erstellen eines Demokontos
+ accounts.put("12345", new Account("12345", 1000.0));
+ }
+
+ public void depositToAccount(String accountNumber, double amount) throws Exception {
+ Account account = accounts.get(accountNumber);
+ if (account != null) {
+ account.deposit(amount);
+ } else {
+ throw new Exception("Account not found");
+ }
+ }
+
+ public void withdrawFromAccount(String accountNumber, double amount) throws Exception {
+ Account account = accounts.get(accountNumber);
+ if (account != null) {
+ account.withdraw(amount);
+ } else {
+ throw new Exception("Account not found");
+ }
+ }
+
+ public double getAccountBalance(String accountNumber) throws Exception {
+ Account account = accounts.get(accountNumber);
+ if (account != null) {
+ return account.getBalance();
+ } else {
+ throw new Exception("Account not found");
+ }
+ }
+}
\ No newline at end of file
diff --git a/src/main/java/de/deversmann/Main.java b/src/main/java/de/deversmann/Main.java
deleted file mode 100644
index b636b6e..0000000
--- a/src/main/java/de/deversmann/Main.java
+++ /dev/null
@@ -1,17 +0,0 @@
-package de.deversmann;
-
-//TIP To Run code, press or
-// click the icon in the gutter.
-public class Main {
- public static void main(String[] args) {
- //TIP Press with your caret at the highlighted text
- // to see how IntelliJ IDEA suggests fixing it.
- System.out.printf("Hello and welcome!");
-
- for (int i = 1; i <= 5; i++) {
- //TIP Press to start debugging your code. We have set one breakpoint
- // for you, but you can always add more by pressing .
- System.out.println("i = " + i);
- }
- }
-}
\ No newline at end of file
diff --git a/src/main/java/de/deversmann/UI/BankUI.java b/src/main/java/de/deversmann/UI/BankUI.java
new file mode 100644
index 0000000..57ec74e
--- /dev/null
+++ b/src/main/java/de/deversmann/UI/BankUI.java
@@ -0,0 +1,47 @@
+package de.deversmann.UI;
+
+import java.util.Scanner;
+
+public class BankUI {
+ private Scanner scanner;
+
+ public BankUI() {
+ this.scanner = new Scanner(System.in);
+ }
+
+ public String getAccountNumber() {
+ System.out.print("Geben Sie die Kontonummer ein: ");
+ return scanner.nextLine();
+ }
+
+ public int getAction() {
+ System.out.print("Wählen Sie eine Aktion (1: Einzahlen, 2: Abheben, 3: Kontostand anzeigen): ");
+ return scanner.nextInt();
+ }
+
+ public double getDepositAmount() {
+ System.out.print("Geben Sie den Einzahlungsbetrag ein: ");
+ return scanner.nextDouble();
+ }
+
+ public double getWithdrawAmount() {
+ System.out.print("Geben Sie den Abhebungsbetrag ein: ");
+ return scanner.nextDouble();
+ }
+
+ public void showBalance(double balance) {
+ System.out.println("Ihr Kontostand beträgt: " + balance);
+ }
+
+ public void showSuccessMessage(String message) {
+ System.out.println(message);
+ }
+
+ public void showErrorMessage(String message) {
+ System.out.println("Fehler: " + message);
+ }
+
+ public void closeScanner() {
+ scanner.close();
+ }
+}
\ No newline at end of file