Procházet zdrojové kódy

Reformatting some code.. still working on what it does

Trinh Tong před 6 roky
rodič
revize
c13cd36aa4

+ 5
- 0
src/main/java/rocks/zipcode/atm/bank/Account.java Zobrazit soubor

@@ -8,14 +8,17 @@ public abstract class Account {
8 8
     private AccountData accountData;
9 9
 
10 10
     public Account(AccountData accountData) {
11
+
11 12
         this.accountData = accountData;
12 13
     }
13 14
 
14 15
     public AccountData getAccountData() {
16
+
15 17
         return accountData;
16 18
     }
17 19
 
18 20
     public void deposit(int amount) {
21
+
19 22
         updateBalance(getBalance() + amount);
20 23
     }
21 24
 
@@ -29,10 +32,12 @@ public abstract class Account {
29 32
     }
30 33
 
31 34
     protected boolean canWithdraw(int amount) {
35
+
32 36
         return getBalance() >= amount;
33 37
     }
34 38
 
35 39
     public int getBalance() {
40
+
36 41
         return accountData.getBalance();
37 42
     }
38 43
 

+ 4
- 0
src/main/java/rocks/zipcode/atm/bank/AccountData.java Zobrazit soubor

@@ -19,18 +19,22 @@ public final class AccountData {
19 19
     }
20 20
 
21 21
     public int getId() {
22
+
22 23
         return id;
23 24
     }
24 25
 
25 26
     public String getName() {
27
+
26 28
         return name;
27 29
     }
28 30
 
29 31
     public String getEmail() {
32
+
30 33
         return email;
31 34
     }
32 35
 
33 36
     public int getBalance() {
37
+
34 38
         return balance;
35 39
     }
36 40
 

+ 4
- 0
src/main/java/rocks/zipcode/atm/bank/Bank.java Zobrazit soubor

@@ -20,6 +20,10 @@ public class Bank {
20 20
         accounts.put(2000, new PremiumAccount(new AccountData(
21 21
                 2000, "Example 2", "example2@gmail.com", 200
22 22
         )));
23
+
24
+        accounts.put(3000, new PremiumAccount(new AccountData(
25
+                2000, "Example 3", "example2@gmail.com", 100
26
+        )));
23 27
     }
24 28
 
25 29
     public ActionResult<AccountData> getAccountById(int id) {

+ 2
- 0
src/main/java/rocks/zipcode/atm/bank/PremiumAccount.java Zobrazit soubor

@@ -8,11 +8,13 @@ public class PremiumAccount extends Account {
8 8
     private static final int OVERDRAFT_LIMIT = 100;
9 9
 
10 10
     public PremiumAccount(AccountData accountData) {
11
+
11 12
         super(accountData);
12 13
     }
13 14
 
14 15
     @Override
15 16
     protected boolean canWithdraw(int amount) {
17
+
16 18
         return getBalance() + OVERDRAFT_LIMIT >= amount;
17 19
     }
18 20
 }