-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathBank.cs
78 lines (71 loc) · 2.03 KB
/
Bank.cs
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
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace MidProject2
{
class Bank
{
private string bankName;
private Account[] myBank;
public Bank(string bankName, int size)
{
this.bankName = bankName;
this.myBank = new Account[size];
}
public string BankName
{
set { this.bankName = value; }
get { return this.bankName; }
}
public Account[] MyBank
{
get { return this.myBank; }
}
public void AddAccount(Account account)
{
bool flag = false;
int num = -1;
for (int i = 0; i < myBank.Length; i++)
{
if (myBank[i] == null)
{
myBank[i] = account;
flag = true;
num = i;
break;
}
}
if (flag) Console.WriteLine("_____ACCOUNT ADDED_____\ntYour Account Number = {0} ", myBank[num].AccountNumber);
else Console.WriteLine("_____SOMETHING IS WRONG CAN'T ADD_____");
}
public void Transaction(int option, params dynamic[] x)
{
if (option == 1)
{
myBank[x[0]].Withdraw(x[1]);
}
else if (option == 2)
{
myBank[x[0]].Diposit(x[1]);
}
else if (option == 3)
{
myBank[x[0]].Transfer(myBank[x[1]], x[2]);
}
else if (option == 4)
{
myBank[x[0]].ChangeOwnerName(Array[1]);
}
else
{
Console.WriteLine("_____WRONG INPUT_____");
}
}
public void PrintAccountDetails()
{
Console.WriteLine("Bank Name : " + this.bankName);
}
}
}