You are on page 1of 21

using System;

using System.Collections.Generic;
using System.Text;

namespace impbank
{
delegate Double account(Double bal);
delegate void withdrawevent();
class wevent
{
public event withdrawevent less_bal;
public void lessbalance()
{
less_bal();
}
};
interface IBank
{
void display(int ano, string name, double bal);
void display1(int ano, string name, double bal);
}
class details
{
private int acno;
private String cname;
private String address;
private String desig;
private int phoneno;
private Double balance;
public double interest;
public double amount;
public double iamount;
public details() { }
public details(int ano, String name, String addr, int pno, Double bal)
{
acno = ano;
cname = name;
address = addr;
phoneno = pno;
balance = bal;
}
public int bank_ano { get { return acno; } set { acno = value; } }
public String bank_name { get { return cname; } set { cname = value; }
}
public String bank_address { get { return address; } set { address =
value; } }
public String bank_desig { get { return desig; } set { desig =
value; } }
public int bank_phno { get { return phoneno; } set { phoneno =
value; } }
public Double bank_bal { get { return balance; } set { balance =
value; } }
};
sealed class cal : details, IBank
{
public cal() { }
public cal(int ano, String name, String addr, int pno, Double bal)
: base(ano, name, addr, pno, bal) { }
public Double deposit(Double bal)
{
Double damt = 0.00d;
dep:
Console.ForegroundColor = ConsoleColor.Yellow;
System.Threading.Thread.Sleep(1000);
Console.WriteLine();
Console.WriteLine();
Console.Write("\t\t\tEnter the amount to deposit : ");
string str = Console.ReadLine();
double Num;
bool isNum = double.TryParse(str, out Num);
if (isNum)
{
damt = Convert.ToDouble(str);
amount = damt;
iamount = bal;
interest = damt * 0.05;
bank_bal = bal + damt + interest;
}
else
{
Console.ForegroundColor = ConsoleColor.Red;
System.Threading.Thread.Sleep(1000);
Console.Beep();
Console.WriteLine();
Console.WriteLine("\t\t\tEnter the amount properly");
Console.ReadKey();
goto dep;
}
return bank_bal;
}
static void wevent_handle()
{
Console.ForegroundColor = ConsoleColor.Red;
System.Threading.Thread.Sleep(1000);
Console.Beep(); Console.WriteLine();
Console.WriteLine("\t\t\tThe minimum balance should be Rs.500");
Console.ReadKey();
}
public Double withdraw(Double bal)
{
Double wamt = 0.00d;
wdraw:
Console.ForegroundColor = ConsoleColor.Yellow;
System.Threading.Thread.Sleep(1000);
Console.WriteLine(); Console.WriteLine();
Console.Write("\t\t\tEnter the amount to withdraw : ");
string str = Console.ReadLine();
double Num;
bool isNum = double.TryParse(str, out Num);
if (isNum)
{
wamt = Convert.ToDouble(str);
if ((bal - wamt) >= 500)
{
amount = wamt;
iamount = bal;
interest = bal * 0.01;
bank_bal = (bal - wamt) + interest;
}
else
{
wevent w = new wevent();
w.less_bal += wevent_handle;
w.lessbalance();
goto wdraw;
}
}
else
{
Console.ForegroundColor = ConsoleColor.Magenta;
System.Threading.Thread.Sleep(1000); Console.Beep();
Console.WriteLine();
Console.WriteLine("\t\t\tEnter the amount properly");
Console.ReadKey();
goto wdraw;
}
return bank_bal;
}
public void display(int ano, string name, double bal)
{
Console.ForegroundColor = ConsoleColor.Green;
System.Threading.Thread.Sleep(1000);

Console.WriteLine("\t---------------------------------------------------------
-------------");
Console.WriteLine("\t\t\t\t\t\t\t\t\t\t ");
Console.WriteLine("\t\t\t\t\tKANARA BANK\t\t\t\t ");
Console.WriteLine("\t\t\t\t\t===========\t\t\t\t ");
Console.WriteLine("\t\t\t\t\t\t\t\t\t\t ");

Console.WriteLine("\t---------------------------------------------------------
-------------");
Console.WriteLine("\t\t\t\t\t\t\t" + DateTime.Now + " ");
System.Threading.Thread.Sleep(1000);

Console.WriteLine("\t---------------------------------------------------------
-------------");
System.Threading.Thread.Sleep(1000);
Console.WriteLine("\t\t\t\t\t\t\t\t\t\t ");
Console.WriteLine("\t Acc. No.\tName\tExisting
Deposit\tInterest\tBalance ");
Console.WriteLine("\t \t \tBalance Amount\t\t\t\t
");
Console.WriteLine("\t\t\t\t\t\t\t\t\t\t ");
System.Threading.Thread.Sleep(1000);

Console.WriteLine("\t---------------------------------------------------------
-------------");
System.Threading.Thread.Sleep(1000);
Console.WriteLine("\t\t\t\t\t\t\t\t\t\t ");
Console.WriteLine("\t KA" + ano + "\t\t" + name + "\t" + iamount
+ "\t " + amount
+ "\t" + interest + "\t\t" + bal + "\t ");
System.Threading.Thread.Sleep(1000);

}
public void display1(int ano, string name, double bal)
{
Console.ForegroundColor = ConsoleColor.Blue;
System.Threading.Thread.Sleep(1000);

Console.WriteLine("\t---------------------------------------------------------
--------------");
Console.WriteLine("\t\t\t\t\t\t\t\t\t\t ");
Console.WriteLine("\t\t\t\t\tKANARA BANK\t\t\t\t ");
Console.WriteLine("\t\t\t\t\t===========\t\t\t\t ");
Console.WriteLine("\t\t\t\t\t\t\t\t\t\t ");

Console.WriteLine("\t---------------------------------------------------------
-------------");
Console.WriteLine("\t\t\t\t\t\t\t" + DateTime.Now + " |");
System.Threading.Thread.Sleep(1000);

Console.WriteLine("\t---------------------------------------------------------
-------------");
System.Threading.Thread.Sleep(1000);
Console.WriteLine("\t\t\t\t\t\t\t\t\t\t ");
Console.WriteLine("\t Acc. No.\tName\tExisting
Withdraw\tInterest\tBalance ");
Console.WriteLine("\t \t \t \tBalance Amount\t\t\t\t
");
Console.WriteLine("\t\t\t\t\t\t\t\t\t\t ");
System.Threading.Thread.Sleep(1000);

Console.WriteLine("\t---------------------------------------------------------
-------------");
System.Threading.Thread.Sleep(1000);
Console.WriteLine("\t\t\t\t\t\t\t\t\t\t ");
Console.WriteLine("\tKA" + ano + "\t\t" + name + "\t" + iamount +
"\t " + amount
+ "\t\t" + interest + "\t\t" + bal + "\t ");
System.Threading.Thread.Sleep(1000);

}
};
class Bank
{
static void Main(string[] args)
{
cal c = new cal();
cal[] c1 = new cal[10];
bool ch2 = true;
string ch = "", name = "", addr = "", ano = "", des = "", ch1 =
"";
Double bal = 0.0d, amt = 0.0d;
int i, pno = 0, no = 100, k = 0;
Boolean find = false;
String nam = "";
i = 0;
account a;
Console.Clear();
Console.ForegroundColor = ConsoleColor.Cyan;
Console.WriteLine("\n\t\t\t\t\tKANARA BANK");
Console.WriteLine("\t\t\t\t\t================");
Console.ResetColor();
do
{
try
{
Console.ForegroundColor = ConsoleColor.DarkGreen;
Console.WriteLine(); Console.WriteLine();
Console.WriteLine("\t\t---------------------------
Menu------------------------------");
Console.WriteLine("\t\t\t\t\t\t\t\t\t ");
Console.WriteLine("\t\t\t\t\t\t\t\t\t ");
Console.WriteLine("\t\t\t Create Account (a)\t\t\t\t
");
Console.WriteLine("\t\t\t\t\t\t\t\t\t ");
Console.WriteLine("\t\t\t Deposit (d)\t\t\t\t\t ");
Console.WriteLine("\t\t\t\t\t\t\t\t\t ");
Console.WriteLine("\t\t\t Withdraw (w)\t\t\t\t\t ");
Console.WriteLine("\t\t\t\t\t\t\t\t\t ");
Console.WriteLine("\t\t\t View Details (v)\t |");
Console.WriteLine("\t\t\t\t\t\t\t\t\t ");

Console.WriteLine("\t\t\t Updating Details (u)\t\t\t\t


");
Console.WriteLine("\t\t\t\t\t\t\t\t\t ");
Console.WriteLine("\t\t\t Delete Account (da)\t\t\t\t
");
Console.WriteLine("\t\t\t\t\t\t\t\t\t ");
Console.WriteLine("\t\t\t Exit (e)\t\t\t\t\t ");
Console.WriteLine("\t\t\t\t\t\t\t\t\t ");

Console.WriteLine("\t\t-------------------------------------------------------
------");
Console.WriteLine(); Console.ResetColor();
Console.ForegroundColor = ConsoleColor.Cyan;
Console.Write("\t\tEnter your choice : ");
ch = Console.ReadLine().Trim().ToLower();
Console.WriteLine(ch);
Console.ResetColor();
Console.Clear(); Console.WriteLine();
switch (ch)
{
case "a":
Console.ForegroundColor = ConsoleColor.Cyan;
Console.WriteLine("\t\t\t\t Account Creation");
Console.WriteLine("\t\t\t\t ****************");
Console.WriteLine();
Console.ResetColor();
Console.ForegroundColor = ConsoleColor.Cyan;
Console.Write("\t\t\tEnter your name : ");
name = Console.ReadLine();
Console.WriteLine();
Console.Write("\t\t\tEnter your address : ");
addr = Console.ReadLine();
Console.WriteLine();
Console.Write("\t\t\tEnter your designation : ");
des = Console.ReadLine();
Console.WriteLine();
Console.Write("\t\t\tEnter your contact no. : ");
pno = Convert.ToInt32(Console.ReadLine());
Console.WriteLine();
do
{
try
{
Console.ForegroundColor =
ConsoleColor.Cyan;
Console.Write("\t\t\tEnter amount to
deposit : ");
bal = Double.Parse(Console.ReadLine());
Console.WriteLine();
if (bal < 500)
{
throw new Exception("Initial deposit
should be atleast Rs.500");
}
}
catch (Exception e)
{
Console.ForegroundColor =
ConsoleColor.Red;
System.Threading.Thread.Sleep(100);
Console.Beep();
Console.WriteLine("\t\tException : " +
e.Message);
Console.WriteLine(); Console.ReadKey();
}
} while (bal < 500);
c1[i] = new cal(no, name, addr, pno, bal);
System.Threading.Thread.Sleep(100);
Console.ForegroundColor = ConsoleColor.Yellow;
Console.WriteLine("\t\t\tYour Account number is
KA" + c1[i].bank_ano);
System.Threading.Thread.Sleep(1000);
Console.ForegroundColor = ConsoleColor.Cyan;
Console.WriteLine(); Console.WriteLine();
Console.WriteLine("\t\t============ Account
Created ============");
Console.WriteLine(); Console.WriteLine();
System.Threading.Thread.Sleep(1000);
Console.ForegroundColor = ConsoleColor.Cyan;
Console.WriteLine("\t\t\t\t\t " +
DateTime.Now);
System.Threading.Thread.Sleep(1000);
Console.WriteLine("\t\t-------------------------------------------------------
-");
System.Threading.Thread.Sleep(1000);
Console.WriteLine("\t\t\tAcc. No.
\tName \tBalance");
System.Threading.Thread.Sleep(1000);

Console.WriteLine("\t\t-------------------------------------------------------
-");
System.Threading.Thread.Sleep(1000);
Console.WriteLine("\t\t\tKA" + c1[i].bank_ano +
"\t\t" +
c1[i].bank_name + "\t\t" + c1[i].bank_bal);
System.Threading.Thread.Sleep(1000);

Console.WriteLine("\t\t-------------------------------------------------------
-");
no++;
i++;
Console.ReadKey();
break;
case "d":
a = c.deposit;
find = false;
amt = 0.0d;
nam = "";
k = 0;
Console.Clear();
Console.WriteLine();
Console.ForegroundColor = ConsoleColor.Yellow;
Console.WriteLine("\t\t\t\tDeposit");
Console.WriteLine("\t\t\t\t******");
Console.WriteLine(); Console.WriteLine();
Console.ForegroundColor = ConsoleColor.Cyan;
Console.Write("\t\tEnter the account number : ");
ano = Console.ReadLine();
if (ano.Length == 5)
{
if (ano.StartsWith("KA"))
{
string s = ano.Substring(2, 3);
int n = Convert.ToInt32(s);
for (k = 0; k < i; k++)
{
if (c1[k].bank_ano == n)
{
find = true;
amt = c1[k].bank_bal;
nam = c1[k].bank_name;
break;
}
else
find = false;
}
if (find == true)
{
Console.Clear();
Console.ForegroundColor = ConsoleColor.Magenta;
Console.WriteLine();
Console.WriteLine();
System.Threading.Thread.Sleep(1000);
Console.WriteLine("\t\t=============
Deposit =============");
Console.WriteLine();
Console.WriteLine();
System.Threading.Thread.Sleep(1000);
Console.ForegroundColor =
ConsoleColor.Yellow;
Console.WriteLine("\t\tNAME :" + nam +
",");
Console.WriteLine();
Console.WriteLine();
Console.ForegroundColor =
ConsoleColor.Magenta;
System.Threading.Thread.Sleep(1000);
Console.WriteLine("\t\t\tBalance : " +
amt);
c1[k].bank_bal = a(amt);
Console.WriteLine();
Console.WriteLine();
Console.ForegroundColor =
ConsoleColor.Cyan;
System.Threading.Thread.Sleep(1000);
Console.WriteLine("\t\t==========
Amount Deposited =========");
Console.WriteLine();
Console.WriteLine();
System.Threading.Thread.Sleep(1000);
Console.ForegroundColor =
ConsoleColor.Magenta;
c.display(c1[k].bank_ano,
c1[k].bank_name, c1[k].bank_bal);
}
else
{
Console.WriteLine();
Console.ForegroundColor =
ConsoleColor.Red;

Console.WriteLine("\t\tInvalid account
number");
}
}
}
Console.ReadKey();
break;
case "w":
a = c.withdraw;
find = false;
amt = 0.0d;
nam = "";
k = 0;
Console.Clear();
Console.ForegroundColor = ConsoleColor.Magenta;
Console.WriteLine("\t\t\t\tWithdraw");
Console.WriteLine("\t\t\t\t********");
Console.WriteLine(); Console.WriteLine();
Console.ForegroundColor = ConsoleColor.Cyan;
Console.Write("\t\tEnter the account number : ");
ano = Console.ReadLine();
if (ano.Length == 5)
{
if (ano.StartsWith("KA"))
{
string s = ano.Substring(2, 3);
int n = Convert.ToInt32(s);

for (k = 0; k < i; k++)


{
if (c1[k].bank_ano == n)
{
find = true;
amt = c1[k].bank_bal;
nam = c1[k].bank_name;
break;
}
else
find = false;
}
if (find == true)
{
Console.Clear();
Console.ForegroundColor =
ConsoleColor.Magenta;
Console.WriteLine();
Console.WriteLine();
System.Threading.Thread.Sleep(1000);
Console.WriteLine("\t\t===========
Withdraw ===========");
Console.WriteLine();
Console.WriteLine();
System.Threading.Thread.Sleep(1000);
Console.ForegroundColor =
ConsoleColor.Yellow;
Console.WriteLine("\t\tNAME:" + nam +
",");
Console.WriteLine();
Console.WriteLine();
Console.ForegroundColor =
ConsoleColor.Cyan;
System.Threading.Thread.Sleep(1000);
Console.WriteLine("\t\t\tBalance : " +
amt);
c1[k].bank_bal = a(amt);
Console.WriteLine();
Console.WriteLine();
Console.ForegroundColor =
ConsoleColor.Cyan;
System.Threading.Thread.Sleep(1000);
Console.WriteLine("\t\t===== Amount
Withdrawn =====");
Console.WriteLine();
Console.WriteLine();
System.Threading.Thread.Sleep(1000);
Console.ForegroundColor =
ConsoleColor.Cyan;
c.display1(c1[k].bank_ano,
c1[k].bank_name, c1[k].bank_bal);
}
else
{
Console.WriteLine();
Console.ForegroundColor =
ConsoleColor.Red;
Console.Beep();
Console.WriteLine("\t\tInvalid account
number");
}
}
}
Console.ReadKey();
break;
case "v":
Console.Clear();
Console.WriteLine(); Console.WriteLine();
Console.ForegroundColor = ConsoleColor.Green;
Console.WriteLine("\t\t---------------------------
Menu------------------------------");
Console.WriteLine("\t\t\t\t\t\t\t\t");
Console.WriteLine("\t\t\t View Details of
particular customer(p) ");
Console.WriteLine("\t\t\t\t\t\t\t\t");
Console.WriteLine("\t\t\t View Details of all
customers(ca) ");
Console.WriteLine("\t\t\t\t\t\t\t\t");
Console.WriteLine("\t\t\t View Details of
customers with balance <= 1000(l)");
Console.WriteLine("\t\t\t\t\t\t\t\t");
Console.WriteLine("\t\t\t View Details of
customers with balance > 1000(g)");
Console.WriteLine("\t\t\t\t\t\t\t\t");

Console.WriteLine("\t\t-------------------------------------------------------
------");
Console.Write("\t\tEnter your choice : ");
ch1 = Console.ReadLine().Trim().ToLower();
Console.WriteLine(ch1);
Console.ResetColor();
Console.Clear(); Console.WriteLine();
if (ch2 == true)
{
switch (ch1)
{
case "p":
Console.WriteLine("\t\t\t Details
of particular Customer");
Console.WriteLine("\t\t\t
******************************");
Console.WriteLine();
Console.WriteLine();
Console.ForegroundColor =
ConsoleColor.Cyan;
Console.Write("\t\tEnter the account
number : ");
ano = Console.ReadLine();
if (ano.Length == 5)
{
if (ano.StartsWith("KA"))
{
string s = ano.Substring(2,
3);
int n = Convert.ToInt32(s);
for (k = 0; k < i; k++)
{
if (c1[k].bank_ano == n)
{
find = true;
amt = c1[k].bank_bal;
nam = c1[k].bank_name;
addr =
c1[k].bank_address;
pno = c1[k].bank_phno;
break;
}
else
find = false;
}
if (find == true)
{
Console.ForegroundColor =
ConsoleColor.Yellow;
Console.WriteLine();
Console.WriteLine();

System.Threading.Thread.Sleep(1000);

Console.WriteLine("\t\t======== Details of " + nam + " ========");


Console.WriteLine();
Console.WriteLine();
Console.ForegroundColor =
ConsoleColor.White;

System.Threading.Thread.Sleep(1000);

Console.WriteLine("\t\t\t\t\t\t\t\t\t\t ");
Console.WriteLine("\t\t\t\t\tKANARA BANK\t\t\t\t ");

Console.WriteLine("\t\t\t\t\t==*==*==\t\t\t\t ");

Console.WriteLine("\t\t\t\t\t\t\t\t\t\t ");

Console.WriteLine("\t---------------------------------------------------------
------");

Console.WriteLine("\t\t\t\t\t\t\t" + DateTime.Now + " ");

System.Threading.Thread.Sleep(1000);

Console.WriteLine("\t---------------------------------------------------------
------");

System.Threading.Thread.Sleep(1000);

Console.WriteLine("\t\t\t\t\t\t\t\t\t\t ");
Console.WriteLine("\t Acc.
No.\tName\tAddress\t ContactNo.\t Balance\t ");

Console.WriteLine("\t\t\t\t\t\t\t\t\t\t ");

System.Threading.Thread.Sleep(1000);

Console.WriteLine("\t---------------------------------------------------------
-----");

System.Threading.Thread.Sleep(1000);

Console.WriteLine("\t\t\t\t\t\t\t\t\t\t ");
Console.WriteLine("\t KA"
+ ano + "\t\t" + nam + "\t" + addr +
"\t \t" + pno + "\t \t" + amt +
"\t ");

System.Threading.Thread.Sleep(1000);

Console.WriteLine("\t\t\t\t\t\t\t\t\t\t ");

}
else
{
Console.WriteLine();
Console.ForegroundColor =
ConsoleColor.Red;
Console.Beep();

Console.WriteLine("\t\tInvalid account number");


}
}
}
Console.ReadKey();
break;
case "ca":
Console.Clear();
Console.ForegroundColor =
ConsoleColor.Yellow;
Console.WriteLine();
Console.WriteLine();
System.Threading.Thread.Sleep(1000);
Console.WriteLine("\t\t========
Details of All Customers =========");
Console.WriteLine();
Console.WriteLine();
Console.ForegroundColor =
ConsoleColor.White;
System.Threading.Thread.Sleep(1000);

Console.WriteLine("\t\t\t\t\t\t\t\t\t\t ");
Console.WriteLine("\t\t\t\t\tKANARA
BANK\t\t\t\t ");

Console.WriteLine("\t\t\t\t\t==*==*==\t\t\t\t ");

Console.WriteLine("\t\t\t\t\t\t\t\t\t\t ");

Console.WriteLine("\t---------------------------------------------------------
--------");
Console.WriteLine("\t\t\t\t\t\t\t" +
DateTime.Now + " ");
System.Threading.Thread.Sleep(1000);

Console.WriteLine("\t---------------------------------------------------------
--------");
System.Threading.Thread.Sleep(1000);

Console.WriteLine("\t\t\t\t\t\t\t\t\t\t ");
Console.WriteLine("\t Acc.
No.\tName\tAddress\t Contact No.\tBalance\t ");

Console.WriteLine("\t\t\t\t\t\t\t\t\t\t ");
System.Threading.Thread.Sleep(1000);

Console.WriteLine("\t---------------------------------------------------------
------");
System.Threading.Thread.Sleep(1000);
for (int j = 0; j < i; j++)
{

Console.WriteLine("\t\t\t\t\t\t\t\t\t\t ");
Console.WriteLine("\t KA" +
c1[j].bank_ano + "\t\t" + c1[j].bank_name +
"\t" + c1[j].bank_address + "\t " + c1[j].bank_phno + "\t "
+ c1[j].bank_bal + "\t\t ");
}
System.Threading.Thread.Sleep(1000);

Console.WriteLine("\t\t\t\t\t\t\t\t\t\t ");

Console.ReadKey();
break;
case "l":
int l = 0;
Console.Clear();
Console.ForegroundColor =
ConsoleColor.Yellow;
Console.WriteLine();
Console.WriteLine();
System.Threading.Thread.Sleep(1000);
Console.WriteLine("\t== Details of
Customers having balance <= Rs.1000 ==");
Console.WriteLine();
Console.WriteLine();
Console.ForegroundColor =
ConsoleColor.White;
System.Threading.Thread.Sleep(1000);

Console.WriteLine("\t\t\t\t\t\t\t\t\t\t ");
Console.WriteLine("\t\t\t\t\tKANARA
BANK\t\t\t\t ");

Console.WriteLine("\t\t\t\t\t==*==*==\t\t\t\t ");

Console.WriteLine("\t\t\t\t\t\t\t\t\t\t ");

Console.WriteLine("\t---------------------------------------------------------
---");
Console.WriteLine("\t\t\t\t\t\t\t" +
DateTime.Now + " ");
System.Threading.Thread.Sleep(1000);

Console.WriteLine("\t--------------------------------------------------------"
);
System.Threading.Thread.Sleep(1000);

Console.WriteLine("\t\t\t\t\t\t\t\t\t\t ");
Console.WriteLine("\t\t Acc.
No.\tName\tAddress\t Contact No.\t Balance\t ");

Console.WriteLine("\t\t\t\t\t\t\t\t\t\t ");
System.Threading.Thread.Sleep(1000);

Console.WriteLine("\t---------------------------------------------------------
");
System.Threading.Thread.Sleep(1000);
for (int j = 0; j < i; j++)
{
if (c1[j].bank_bal <= 1000)
{
l = l + 1;

Console.WriteLine("\t\t\t\t\t\t\t\t\t\t ");
Console.WriteLine("\t KA" +
c1[j].bank_ano + "\t\t" + c1[j].bank_name
+ "\t" + c1[j].bank_address + "\t " +
c1[j].bank_phno + "\t " + c1[j].bank_bal +
"\t\t ");
}
}
if (l == 0)
Console.WriteLine("\t\t\tNo
customer is having balance <= Rs.1000\t\t ");
System.Threading.Thread.Sleep(1000);

Console.WriteLine("\t\t\t\t\t\t\t\t\t\t ");

Console.ReadKey();
break;
case "g":
int g = 0;
Console.Clear();
Console.ForegroundColor =
ConsoleColor.Yellow;
Console.WriteLine();
Console.WriteLine();
System.Threading.Thread.Sleep(1000);
Console.WriteLine("\t= Details of
Customers having balance > Rs.1000 =");
Console.WriteLine();
Console.WriteLine();
Console.ForegroundColor =
ConsoleColor.White;
System.Threading.Thread.Sleep(1000);

Console.WriteLine("\t\t\t\t\t\t\t\t\t\t ");
Console.WriteLine("\t\t\t\t\tKANARA
BANK\t\t\t\t ");

Console.WriteLine("\t\t\t\t\t==*==*==\t\t\t\t ");

Console.WriteLine("\t\t\t\t\t\t\t\t\t\t ");

Console.WriteLine("\t---------------------------------------------------------
-");
Console.WriteLine("\t\t\t\t\t\t\t" +
DateTime.Now + " ");
System.Threading.Thread.Sleep(1000);
Console.WriteLine("\t---------------------------------------------------------
-");
System.Threading.Thread.Sleep(1000);

Console.WriteLine("\t\t\t\t\t\t\t\t\t\t ");
Console.WriteLine("\t Acc.
No.\tName\tAddress\t Contact No.\t Balance\t ");

Console.WriteLine("\t\t\t\t\t\t\t\t\t\t ");
System.Threading.Thread.Sleep(1000);

Console.WriteLine("\t---------------------------------------------------------
-");
System.Threading.Thread.Sleep(1000);
for (int j = 0; j < i; j++)
{
if (c1[j].bank_bal > 1000)
{
g = g + 1;

Console.WriteLine("\t\t\t\t\t\t\t\t\t\t ");
Console.WriteLine("\t KA" +
c1[j].bank_ano + "\t\t" + c1[j].bank_name
+ "\t" + c1[j].bank_address + "\t" +
c1[j].bank_phno + "\t " + c1[j].bank_bal + "\t\t ");

}
}
if (g == 0)
Console.WriteLine("\t\t\tNo
customer is having balance greater than Rs.1000\t |");

System.Threading.Thread.Sleep(1000);

Console.ReadKey();
break;
}

}
break;
case "u":
Console.Clear();
Console.WriteLine(); Console.WriteLine();
Console.ForegroundColor = ConsoleColor.Magenta;
Console.WriteLine("\t\t\t\t Updating Account ");
Console.WriteLine("\t\t\t\t **************** ");
Console.WriteLine(); Console.WriteLine();
Console.ForegroundColor = ConsoleColor.Cyan;
Console.Write("\t\tEnter the account number : ");
ano = Console.ReadLine();
if (ano.Length == 5)
{
if (ano.StartsWith("KA"))
{
string s = ano.Substring(2, 3);
int n = Convert.ToInt32(s);
for (k = 0; k < i; k++)
{
if (c1[k].bank_ano == n)
{
find = true;
amt = c1[k].bank_bal;
nam = c1[k].bank_name;
addr = c1[k].bank_address;
pno = c1[k].bank_phno;
break;
}
else
find = false;
}
if (find == true)
{
Console.Clear();
Console.ForegroundColor =
ConsoleColor.Yellow;
Console.WriteLine();
Console.WriteLine();
System.Threading.Thread.Sleep(1000);
Console.WriteLine("\t\t=== Updating
details of " + nam + "==");
Console.WriteLine();
Console.WriteLine();
Console.ForegroundColor =
ConsoleColor.Magenta;
Console.WriteLine("\t\t\t\t1-
>Address");
Console.WriteLine();
Console.WriteLine("\t\t\t\t2->Contact
number");
Console.WriteLine();
Console.ForegroundColor =
ConsoleColor.Cyan;
Console.Write("\t\tEnter your choice :
");
int ui;
string naddr;
int nphno;
ui =
Convert.ToInt32(Console.ReadLine());
Console.WriteLine();
switch (ui)
{
case 1:
Console.ForegroundColor =
ConsoleColor.White;
Console.WriteLine("\t\tYour
old address : " + c1[k].bank_address);
Console.WriteLine();
System.Threading.Thread.Sleep(1000);
Console.Write("\t\tEnter the
new address : ");
naddr = Console.ReadLine();
Console.WriteLine();
c1[k].bank_address = naddr;
Console.WriteLine();
Console.WriteLine();

System.Threading.Thread.Sleep(1000);
Console.ForegroundColor =
ConsoleColor.Yellow;
Console.WriteLine("\t\t====
Details of " + nam + " ===");
Console.WriteLine();

System.Threading.Thread.Sleep(1000);
Console.ForegroundColor =
ConsoleColor.Magenta;

Console.WriteLine("\t\t\tAccount number : " + c1[k].bank_ano);


Console.WriteLine("\t\t\tName
: " + c1[k].bank_name);

Console.WriteLine("\t\t\tAddress : " + c1[k].bank_address);

Console.WriteLine("\t\t\tContact Number : " + c1[k].bank_phno);

Console.WriteLine("\t\t\tBalance : " + c1[k].bank_bal);


break;
case 2:
Console.ForegroundColor =
ConsoleColor.White;
Console.WriteLine("\t\tYour
old contact number : " +
c1[k].bank_phno);
Console.WriteLine();

System.Threading.Thread.Sleep(1000);
Console.Write("\t\tEnter the
new contact number : ");
nphno =
Convert.ToInt32(Console.ReadLine());
Console.WriteLine();
c1[k].bank_phno = nphno;
Console.WriteLine();
Console.WriteLine();

System.Threading.Thread.Sleep(1000);
Console.ForegroundColor =
ConsoleColor.Yellow;
Console.WriteLine("\t\t====
Details of " + nam + " ====");
Console.WriteLine();
System.Threading.Thread.Sleep(1000);
Console.ForegroundColor =
ConsoleColor.Magenta;

Console.WriteLine("\t\t\tAccount number : " + c1[k].bank_ano);


Console.WriteLine("\t\t\tName
: " + c1[k].bank_name);

Console.WriteLine("\t\t\tAddress : " + c1[k].bank_address);

Console.WriteLine("\t\t\tContact Number : " + c1[k].bank_phno);

Console.WriteLine("\t\t\tBalance : " + c1[k].bank_bal);


break;
default:
Console.ForegroundColor =
ConsoleColor.Red;
Console.WriteLine("\t\tEnter
the correct option");
Console.ReadKey();
break;
}
}
else
{
Console.WriteLine();
Console.ForegroundColor =
ConsoleColor.Red;
Console.Beep();
Console.WriteLine("\t\tInvalid account
number");
}
}
}
Console.ReadKey();
break;
case "da":
Console.Clear(); Console.WriteLine();
Console.WriteLine();
Console.ForegroundColor = ConsoleColor.Magenta;
Console.WriteLine("\t\t\t\t Deleting Account ");
Console.WriteLine("\t\t\t\t ************** ");
Console.WriteLine(); Console.WriteLine();
Console.ForegroundColor = ConsoleColor.Cyan;
Console.Write("\t\tEnter the account number : ");
ano = Console.ReadLine();
if (ano.Length == 5)
{
if (ano.StartsWith("KA"))
{
string s = ano.Substring(2, 3);
int n = Convert.ToInt32(s);
for (k = 0; k < i; k++)
{
if (c1[k].bank_ano == n)
{
find = true;
amt = c1[k].bank_bal;
nam = c1[k].bank_name;
break;
}
else
find = false;
}
if (find == true)
{
Console.Clear();
Console.ForegroundColor =
ConsoleColor.Yellow;
Console.WriteLine();
Console.WriteLine();
System.Threading.Thread.Sleep(1000);
Console.WriteLine("\t\t== Deleting
account of " + nam + " ==");
Console.WriteLine();
Console.WriteLine();
Console.ForegroundColor =
ConsoleColor.Red;
System.Threading.Thread.Sleep(1000);
Console.Write("\t\tAre you sure to
delete the account? (y/n) ");
Console.WriteLine();
Console.WriteLine();
char yn;
yn = Convert.ToChar(Console.Read());
if ((yn.Equals('y')) ||
(yn.Equals('Y')))
{
Console.ForegroundColor =
ConsoleColor.Magenta;
Console.WriteLine("\t\tFirst
withdraw your balance amountRs." + amt);

System.Threading.Thread.Sleep(1000);
c1[k].bank_ano = 0;
c1[k].bank_name = "";
c1[k].bank_desig = "";
c1[k].bank_phno = 0;
c1[k].bank_bal = 0;
Console.WriteLine();
Console.WriteLine();
Console.ForegroundColor =
ConsoleColor.Green;
Console.WriteLine("\t\tThanks for
being our customer");
Console.ReadKey();
}
else
{
Console.WriteLine();
Console.WriteLine();
Console.ForegroundColor =
ConsoleColor.Green;
Console.WriteLine("\t\tYou can
continue as our customer");
Console.ReadKey();
}
}
else
{
Console.WriteLine();
Console.ForegroundColor =
ConsoleColor.Red;
Console.Beep();
Console.WriteLine("\t\tInvalid account
number");
}
}
}
Console.ReadKey();
break;
default:
break;
}
Console.Clear();
}
catch
{
Console.WriteLine("Exception");
Console.ReadKey();
}
Console.Clear();
} while ((ch.Trim().ToLower() != "e"));
}
}

You might also like