-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathNationalizedBank.java
More file actions
37 lines (31 loc) · 1.29 KB
/
NationalizedBank.java
File metadata and controls
37 lines (31 loc) · 1.29 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
import java.util.*;
public class NationalizedBank extends Bank {
private List<Account> accounts = new ArrayList<>();
public NationalizedBank(String bankName, String branchName) {
super(bankName, branchName);
}
@Override
public void openAccount(Account account) {
accounts.add(account);
System.out.println("Account successfully opened at " + bankName + " (Nationalized Bank).");
}
@Override
public void displayBankInfo() {
System.out.println("\n============ " + bankName + " ============");
System.out.println("Branch: " + branchName);
System.out.println("Bank Code: " + bankCode + " (Nationalized)");
if (accounts.isEmpty()) {
System.out.println("No accounts have been opened at this branch yet.");
return;
}
System.out.println("\nAccount Details:");
System.out.println("----------------------------------");
for (Account acc : accounts) {
acc.showAccountType();
System.out.println("Account #: " + acc.accountNumber);
System.out.println("Account Holder: " + acc.holderName);
System.out.println("Current Balance: ₹" + acc.getBalance());
System.out.println("----------------------------------");
}
}
}