-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathProgram.cs
149 lines (127 loc) · 6.22 KB
/
Program.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
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
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace MidProject2
{
class Program
{
private static int accno = 0;
public static int AutoIdGenerator()
{
accno++;
return accno;
}
static void Main(string[] args)
{
Bank bank = new Bank("TEST BANK", 100);
Console.WriteLine("\n_______PLEASE SELECT OPTION THOUGH TYPING COMMAND GIVEN IN THE BRACKET_______");
Console.WriteLine("\n_______Select Required Option_______");
Console.Write("1. Open Account(open)\n2. Make Transaction(account)\n3. Exit(quit)\n\nEnter : ");
string x = System.Console.ReadLine();
switch (x)
{
case "open":
Console.WriteLine("\n______Select Account Type_______ ");
Console.Write("1. Savings Account(savings)\n2. Checkings Account(checkings)\n3. Exit(quit)\n\nEnter : ");
string y = System.Console.ReadLine();
break;
switch (y)
{
case "savings" && "checkings":
{
Console.Write("\n______Enter Details_______ \nName : ");
string accountName = Console.ReadLine();
Console.Write("Balance : ");
double balance = Convert.ToDouble(Console.ReadLine());
Console.Write("\n_______Address_______\nRoad No. : ");
string roadNo = Console.ReadLine();
Console.Write("House No. : ");
string houseNo = Console.ReadLine();
Console.Write("City : ");
string city = Console.ReadLine();
Console.Write("Country : ");
string country = Console.ReadLine();
int id = AutoIdGenerator();
b1.AddAccount(new Account(id, accountName, balance, new Address(roadNo, houseNo, city, country)));
Console.WriteLine("_____ACCOUNT CREATED SUCCESSFULLY_____");
break;
}
case "quit":
{
break;
}
break;
}
case "account":
{
Console.Write("Enter You Account Number : ");
int accountNumber = Convert.ToInt32(Console.ReadLine());
int found = b1.SearchAccount(accountNumber);
if(found >=0)
{
Console.Write("\n_______Select What You Want_______\n1. Make a Withdraw(withdraw)\n2. Make a Deposit(diposit)");
Console.Write("3. Make a Transfer(transfer)\n4. Change Name(change)\n5. Show Account Details(show) \n6. Exit\n\nEnter : ");
string z = System.Console.ReadLine();
switch (z)
{
case "withdraw":
{
Console.Write("Enter the amount you want to withdraw : ");
double amount = Convert.ToDouble(Console.ReadLine());
b1.Transaction(z, found, amount);
break;
}
case "diposit":
{
Console.Write("Enter the amount you want to Deposit : ");
double amount = Convert.ToDouble(Console.ReadLine());
break;
}
case "transfer":
{
Console.Write("Enter Receiver Account Number : ");
int recAccountNum = Convert.ToInt32(Console.ReadLine());
break;
}
case "change":
{
Console.Write("Enter Account Number You want to change: ");
int AccountNum = Convert.ToInt32(Console.ReadLine());
break;
}
case "show":
{
Console.WriteLine("_____ACCOUNT INFORMATION_____");
b1.PrintAccountDetails();
}
case "quit":
{
break;
}
default:
{
Console.WriteLine("_____WRONG INPUT!!_____");
break;
}
}
}
else
{
Console.WriteLine("_____WRONG INPUT!!_____");
}
}
case "quit":
{
break;
}
default:
{
Console.WriteLine("_____WRONG INPUT!!_____");
break;
}
}
}
}
}