-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathBankProcess.java
More file actions
91 lines (87 loc) · 2.42 KB
/
BankProcess.java
File metadata and controls
91 lines (87 loc) · 2.42 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
package com.bank.bankapp;
public class BankProcess extends account{
public BankAccount []accounts;
public int numofAccounts;
public BankProcess() {
accounts =new BankAccount[100];
numofAccounts=0;
}
@Override
int openSavingAccount(String name, double balance,String location) {
BankAccount b=new BankAccount(name, balance, location);
accounts[numofAccounts]=b;
numofAccounts++;
return b.getAccountNUM();
}
@Override
int openCurrentAccount(double balance,String name,String location) {
BankAccount b=new BankAccount(balance, name, location);
accounts[numofAccounts]=b;
numofAccounts++;
return b.getAccountNUM();
}
public void withDrawnForm(int accNum,double amount) {
for (int i = 0; i <numofAccounts; i++) {
if(accNum==accounts[i].getAccountNUM()) {
accounts[i].withdraw(amount);
System.out.println("amount successfully withdrawn");
} else
{
System.out.println("Account Number is NOT FOUND!!");
}
}
}
public void depositeTO(int accNum,double amount) {
for (int j= 0; j<numofAccounts; j++) {
if(accNum==accounts[j].getAccountNUM()) {
accounts[j].deposite(amount);
System.out.println("amount deposited successfully");
}
else {
System.out.println("Account number is NOT FOUND!!");
}
}
}
public void AccountDetails(int accNum) {
for (int i = 0; i <numofAccounts; i++) {
if(accNum==accounts[i].getAccountNUM()) {
accounts[i].getInfo();
}
else
System.out.println("Account Number is NOT FOUND!!");
}
}
public void TransactionDetails(int accNum) {
for (int i = 0; i <numofAccounts; i++) {
if(accNum==accounts[i].getAccountNUM()) {
System.out.println("Transaction details:");
for (int j = 0; j <accounts[i].getNumberofTransaction(); j++) {
System.out.println("TR_NO "+ (j+1) +":"+accounts[i].getTransaction(j));
}
}
else {
System.out.println("account number is NOT FOUND!!");
}
}
}
public void withtransdetail(int accNum) {
for (int i = 0; i <numofAccounts; i++) {
if(accNum==accounts[i].getAccountNUM()) {
accounts[i].withtrandetail();
}
else {
System.out.println("account NUmber is NOT FOUND!!");
}
}
}
public void depositetransDetails(int accNum) {
for (int i = 0; i <numofAccounts; i++) {
if(accNum==accounts[i].getAccountNUM()) {
accounts[i].DepositetransDetails();
}
else {
System.out.println("Account Number is NOT found!!");
}
}
}
}