diff --git a/.vscode/launch.json b/.vscode/launch.json new file mode 100644 index 0000000..5570fe5 --- /dev/null +++ b/.vscode/launch.json @@ -0,0 +1,12 @@ +{ + "configurations": [ + { + "type": "java", + "name": "Launch BankController", + "request": "launch", + "mainClass": "bank.BankController", + "projectName": "Lab15_OOP_90898795", + "vmArgs": "-enableassertions" + } + ] +} \ No newline at end of file diff --git a/bin/bank/BankAccount.class b/bin/bank/BankAccount.class index 326e506..97add34 100644 Binary files a/bin/bank/BankAccount.class and b/bin/bank/BankAccount.class differ diff --git a/bin/bank/Checking.class b/bin/bank/Checking.class index 2474003..f745778 100644 Binary files a/bin/bank/Checking.class and b/bin/bank/Checking.class differ diff --git a/bin/bank/Savings.class b/bin/bank/Savings.class index 7712331..2f9c7b3 100644 Binary files a/bin/bank/Savings.class and b/bin/bank/Savings.class differ diff --git a/src/bank/BankAccount.java b/src/bank/BankAccount.java index 0933b8e..c914dc8 100644 --- a/src/bank/BankAccount.java +++ b/src/bank/BankAccount.java @@ -8,18 +8,27 @@ public abstract class BankAccount { return balance; } public void deposit(double amount){ + if(amount<0){ + error("cannot deposit this amount !"); + return; + } balance += amount; } public boolean withdraw(double amount){ if(balance0){ + error("Min balance can't be positive"); + return; + } this.owner = owner; this.balance = amount; this.minBalance = minBalance; } - public void setMinBalance(double minBalance) { + protected void setMinBalance(double minBalance) { + if(minBalance>0){ + error("Min balance can't be positive"); + return; + } this.minBalance = minBalance; } public double getMinBalance() { return minBalance; } + + @Override + public boolean withdraw(double amount){ + if((balance-minBalance)