Seth 5 år sedan
förälder
incheckning
b3a812a05f

+ 5
- 1
src/main/java/rocks/zipcode/quiz5/objectorientation/account/BankAccount.java Visa fil

21
 
21
 
22
 
22
 
23
     public void deposit(Double amountToIncreaseBy) {
23
     public void deposit(Double amountToIncreaseBy) {
24
-        balance += amountToIncreaseBy;
24
+        if(amountToIncreaseBy >= 0) {
25
+            balance += amountToIncreaseBy;
26
+        } else {
27
+            throw new IllegalArgumentException();
28
+        }
25
     }
29
     }
26
 
30
 
27
     public void withdrawal(Double amountToDecreaseBy) {
31
     public void withdrawal(Double amountToDecreaseBy) {