From b8951031cdf6a6fd03d42121ae80d18bfaffe511 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?R=C3=A9mi=20Heredero?= Date: Wed, 4 May 2022 10:15:11 +0200 Subject: [PATCH] Co-authored-by: Fastium --- .vscode/launch.json | 12 ++++++++++++ bin/bank/BankAccount.class | Bin 1266 -> 1479 bytes bin/bank/Checking.class | Bin 632 -> 1116 bytes bin/bank/Savings.class | Bin 738 -> 1044 bytes src/bank/BankAccount.java | 15 ++++++++++++--- src/bank/Checking.java | 29 +++++++++++++++++++++++++++-- src/bank/Savings.java | 21 +++++++++++++++++---- 7 files changed, 68 insertions(+), 9 deletions(-) create mode 100644 .vscode/launch.json 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 326e5066bae4cb05a82ac0bccad9cbcf988d3343..97add3433d512c55b6963ad06b5094104cebffef 100644 GIT binary patch literal 1479 zcmZ`&ZBx@&6n-u(B-DVl0-{!pqS98Sx~uCdz5?PK2s1c1`Ylbb5N(rANJ0O}e()za zv+8Jdc4zzn{wT-iBta?Qbmr#X-gD0La?knp{lBjOE@RO^k3zoY_%EwdTyDE=(Dow( zS^oRNS$C=p$6u)~)Lv*eQZQ-`&#qQbGYY-IhOa|~!rZUOr6~0Ll}UxZYo6~#Hxx3Z z^0Gp9I;iU$G8nMXkDS8ZInURR+Rd5{A3L=MOBUt=*J&&}p(p3`&up~nt;yYXiiF6m z=xAz_5MgHep)hQr7k#8!*R5d9Bk62uro3$8phD4gd_Rcn^vagnw$l{F_VFB(4_heW z2$ktD45)0lv{PF78O0?@3Ij`#|J~J_{( zINfFV((AQIH!YMUQk`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w@0jnrdEMW5{<=`f6 z@n1#UH^r)Gp13g`sZk6pFdj$z7vYQ~L=uZ}&YI2gsD^rfLdi@ykgr~!pn6Sqk?sH` z!cJ1;6o;50^sJUt)TH@=q`Y=gX!h-q6Ax;Urt%w9tu zPvADq=xyVG$VzL4m!}m#tI8#$?c6e5Keu19T5ZvEji&gqt`$KeP RAiAR68;CBD@vc^P?>7%M$2tH2 delta 341 zcmY*TO-{l<7=6=r209tQYFny;(v@a3x^(Bx18@W&?$nig&S2&sgoMV#7!KeWJcuje zo3SBr^L_98c|YIXpG1G{KDGevP`~L{okE~*Fu;Kuh`Km5ID!)B%x6!tm&Kz$7w$n! z-KV&Aavg=2P)7>4p5osbg+Bm-Mud5Tf%eNS(nM%jyhW;##|EqlSB471uBC|(pb1jaaP gwQl+2Ev4NcUlIJ}_HSSwpVI`K$yP_;JiJYQ0iXRGkN^Mx diff --git a/bin/bank/Savings.class b/bin/bank/Savings.class index 7712331817f7c9f73a1ce0ce268dd8d674257cd0..2f9c7b368aefbfbf3b0753e0e78055ba0afc85e8 100644 GIT binary patch delta 646 zcmYjNO=}ZT6g@99=}e}RG|fjR+9pnGwaFxL{Ei9=1y= z#bt;K7ybt+G%79>SAtvrfj>mOGlbygzH{C^@7(k5@8nzE`1$9{R{$;Cni!+oIx-BE zU1@XA^G7nYkN8;Fp>KDD&86+Xlp-*|kTtQ2979qBfgdmwCy(--+JTM&Lvz<|^Knmh z7bYH;J98^;OVQEHP*u zKH$<5QTN>B+r#a2JLF#f0e`X2I|HF%hhjeCWA2iy>$byyB27)!+Nz_ep}|l%662ve z3VVa0d!L8mafD1nU4LXfU(V~7q#S)$OoKG<7Kd|iN(jT$% zpQNkuYb?7O@!4}Tb86jE}g^kcQMNPygNk}Chkc;w{Ca4;i zhKq^9n00qh-ugeH5*rW-1d4v9q$VvSBM3)r7Q&w3S#{vX${3A~7Kr z9>5b=dk}GFh}hhFa_&9n+HH{WE40->xJ5u|Abq+aala?K8WNe*vjN3*)0DHbN<2{ YmRQch999HrvT4&~RsK?PTIv&g10%93EdT%j 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)