-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathProblem1bank.java
More file actions
212 lines (166 loc) · 5.91 KB
/
Copy pathProblem1bank.java
File metadata and controls
212 lines (166 loc) · 5.91 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
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
package testop;
import java.time.LocalDate;
import java.util.ArrayList;
import java.util.List;
public class Problem1bank {
static class Customer {
private String name;
private String address;
private String phoneNumber;
private String email;
private LocalDate dateOfBirth;
// Getters and Setters
public String getName() {
return name;
}
public void setName(String name) {
this.name = name;
}
public String getAddress() {
return address;
}
public void setAddress(String address) {
this.address = address;
}
public String getPhoneNumber() {
return phoneNumber;
}
public void setPhoneNumber(String phoneNumber) {
this.phoneNumber = phoneNumber;
}
public String getEmail() {
return email;
}
public void setEmail(String email) {
this.email = email;
}
public LocalDate getDateOfBirth() {
return dateOfBirth;
}
public void setDateOfBirth(LocalDate dateOfBirth) {
this.dateOfBirth = dateOfBirth;
}
@Override
public String toString() {
return "Customer{name='" + name + "', address='" + address + "', phoneNumber='" + phoneNumber + "', email='" + email + "', dateOfBirth=" + dateOfBirth + '}';
}
}
static class Account {
private String accountNumber;
private double balance;
// Getters and Setters
public String getAccountNumber() {
return accountNumber;
}
public void setAccountNumber(String accountNumber) {
this.accountNumber = accountNumber;
}
public double getBalance() {
return balance;
}
public void setBalance(double balance) {
this.balance = balance;
}
@Override
public String toString() {
return "Account{accountNumber='" + accountNumber + "', balance=" + balance + '}';
}
}
static class Transaction {
private String transactionId;
private double amount;
private LocalDate transactionDate;
// Getters and Setters
public String getTransactionId() {
return transactionId;
}
public void setTransactionId(String transactionId) {
this.transactionId = transactionId;
}
public double getAmount() {
return amount;
}
public void setAmount(double amount) {
this.amount = amount;
}
public LocalDate getTransactionDate() {
return transactionDate;
}
public void setTransactionDate(LocalDate transactionDate) {
this.transactionDate = transactionDate;
}
@Override
public String toString() {
return "Transaction{transactionId='" + transactionId + "', amount=" + amount + "', transactionDate=" + transactionDate + '}';
}
}
static class Loan {
private String loanId;
private double amount;
private LocalDate loanDate;
// Getters and Setters
public String getLoanId() {
return loanId;
}
public void setLoanId(String loanId) {
this.loanId = loanId;
}
public double getAmount() {
return amount;
}
public void setAmount(double amount) {
this.amount = amount;
}
public LocalDate getLoanDate() {
return loanDate;
}
public void setLoanDate(LocalDate loanDate) {
this.loanDate = loanDate;
}
@Override
public String toString() {
return "Loan{loanId='" + loanId + "', amount=" + amount + "', loanDate=" + loanDate + '}';
}
}
static class BankApplication {
private static List<Customer> customers = new ArrayList<>();
private static List<Account> accounts = new ArrayList<>();
private static List<Transaction> transactions = new ArrayList<>();
private static List<Loan> loans = new ArrayList<>();
public static void main(String[] args) {
Customer customer = new Customer();
customer.setName("John Doe");
customer.setAddress("123 Main St");
customer.setPhoneNumber("123-456-7890");
customer.setEmail("[email protected]");
customer.setDateOfBirth(LocalDate.of(1990, 1, 1));
// Add customer to the list
customers.add(customer);
// Create an account
Account account = new Account();
account.setAccountNumber("123456789");
account.setBalance(1000.00);
// Add account to the list
accounts.add(account);
// Create a transaction
Transaction transaction = new Transaction();
transaction.setTransactionId("TXN001");
transaction.setAmount(500.00);
transaction.setTransactionDate(LocalDate.now());
// Add transaction to the list
transactions.add(transaction);
// Create a loan
Loan loan = new Loan();
loan.setLoanId("LN001");
loan.setAmount(10000.00);
loan.setLoanDate(LocalDate.now());
// Add loan to the list
loans.add(loan);
// Print out the lists
System.out.println("Customers: " + customers);
System.out.println("Accounts: " + accounts);
System.out.println("Transactions: " + transactions);
System.out.println("Loans: " + loans);
}
}
}