-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathBankInformmation.java
More file actions
59 lines (53 loc) · 2 KB
/
Copy pathBankInformmation.java
File metadata and controls
59 lines (53 loc) · 2 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
import java.util.*;
class BankAccount {
int Account_Number;
double Balance;
String Account_Holder_Name;
void depositMoney(int Deposit) {
Scanner sc = new Scanner(System.in);
System.out.print("How Much Money You Want To Deposit = ");
Deposit = sc.nextInt();
Balance = Balance + Deposit;
sc.close();
}
void withdrawMoney(int Withdraw) {
Scanner sc = new Scanner(System.in);
System.out.print("How Much Money You Want To Withdraw = ");
Withdraw = sc.nextInt();
Balance = Balance - Withdraw;
sc.close();
}
void checkBalance(int Balance) {
System.out.print("Balance = " + Balance);
}
}
public class BankInformmation {
public static void main(String[] args) {
Scanner sc = new Scanner(System.in);
BankAccount[] b1 = new BankAccount[2];
for (int i = 0; i < 2; i++) {
b1[i] = new BankAccount();
System.out.println("Enter Detail Of Account " + (i + 1) + " : ");
System.out.print("Enter Account Number = ");
b1[i].Account_Number = sc.nextInt();
System.out.print("Enter How Many Balance In Account = ");
b1[i].Balance = sc.nextDouble();
sc.nextLine();
System.out.print("Enter Account Holder Name = ");
b1[i].Account_Holder_Name = sc.nextLine();
}
System.out.println("Details Of Account Holders");
for (int i = 0; i < 2; i++) {
System.out.println("Details Of Account " + (i + 1) + " : ");
System.out.println("Account Number = " + b1[i].Account_Number);
System.out.println("Balance = " + b1[i].Balance);
System.out.println("Account Holder Name = " + b1[i].Account_Holder_Name);
}
for (int i = 0; i < 2; i++) {
b1[i].depositMoney(i);
b1[i].withdrawMoney(i);
b1[i].checkBalance(i);
}
sc.close();
}
}