static void Main(string[] args) { BankAccountTypeEnum savings = BankAccountTypeEnum.Saving; BankAccountTypeEnum current = BankAccountTypeEnum.Current; ICICI icicisav = new ICICI(); icicisav.AccountType = savings; icicisav.Deposit(50000); ICICI icicicur = new ICICI(); icicicur.AccountType = current; icicicur.Deposit(20000); Console.WriteLine("The Balance Of 1st Account" + icicisav.GetBalance()); Console.WriteLine("The Balance Of 2st Account" + icicicur.GetBalance()); icicisav.Transfer(icicicur, 5000); Console.WriteLine("The Balance Of 1st Account After Transfer" + icicisav.GetBalance()); Console.WriteLine("The Balance Of 2st Account After Transfer" + icicicur.GetBalance()); Console.ReadKey(); }
static void Main(string[] args) { ICICI i1 = new ICICI(); int AccType = (int)BankAccountTypeEnum.Saving; Console.WriteLine("Depositing 50000"); i1.Deposit(50000); i1.GetBalance(); ICICI i2 = new ICICI(); int AccType2 = (int)BankAccountTypeEnum.Current; Console.WriteLine("Depositing 20000"); i2.Deposit(20000); i2.GetBalance(); i1.Transfer(i2, 5000); i1.GetBalance(); i2.GetBalance(); HSBC h1 = new HSBC(); int AccType1 = (int)BankAccountTypeEnum.Saving; Console.WriteLine("Depositing 30000"); h1.Deposit(30000); h1.GetBalance(); HSBC h2 = new HSBC(); int AccType3 = (int)BankAccountTypeEnum.Current; Console.WriteLine("Depositing 20000"); h2.Deposit(20000); h2.GetBalance(); h1.Transfer(h2, 20000); h1.GetBalance(); h2.GetBalance(); Console.ReadKey(); }
static void Main(string[] args) { List <object> arrayList = new List <object>(); int i, j, bankk, acctype; void fucntionss() { Console.WriteLine(methodcall.deposit + " " + (int)methodcall.deposit); Console.WriteLine(methodcall.transfer + " " + (int)methodcall.transfer); Console.WriteLine(methodcall.withdraw + " " + (int)methodcall.withdraw); Console.WriteLine(methodcall.getbalance + " " + (int)methodcall.getbalance); } do { Console.WriteLine("Enter the bank:"); Console.WriteLine(bank.ICICI + " " + (int)bank.ICICI); Console.WriteLine(bank.HSBC + " " + (int)bank.HSBC); bankk = int.Parse(Console.ReadLine()); switch (bankk) { case 0: break; case 1: break; case 2: Console.Write("Exit from bankk"); break; } if (bankk != 2) { do { Console.WriteLine("Enter the account type:"); Console.WriteLine(BankAccountTypeEnum.Saving + " " + (int)BankAccountTypeEnum.Saving); Console.WriteLine(BankAccountTypeEnum.Current + " " + (int)BankAccountTypeEnum.Current); acctype = int.Parse(Console.ReadLine()); //i = int.Parse(Console.ReadLine()); switch (acctype) { case 0: ICICI icicisave = new ICICI(); var hsbcsave = new LQ5LibraryProject.HSBC(); IBankAccount bankAccountinterfaceicici = new ICICI(); IBankAccount bankAccountinterfacehsbc = new HSBC(); arrayList.Add(bankAccountinterfaceicici); arrayList.Add(bankAccountinterfacehsbc); do { Console.WriteLine("select function:"); fucntionss(); j = int.Parse(Console.ReadLine()); switch (j) { case 0: if (acctype == 0 && bankk == 0) { // var icsave = new LQ5LibraryProject.ICICI(); Console.WriteLine("Enter the deposit amount:"); double amount = double.Parse(Console.ReadLine()); double result = icicisave.Deposit(amount); Console.WriteLine("balance is:" + result); } else if (acctype == 0 && bankk == 1) { Console.WriteLine("Enter the deposit amount:"); double amount = double.Parse(Console.ReadLine()); double result = hsbcsave.Deposit(amount); Console.WriteLine("balance is:" + result); } break; case 1: if (acctype == 0 && bankk == 0) { Console.WriteLine("Enter the transfer amount:"); double amount = double.Parse(Console.ReadLine()); Console.WriteLine("Enter the transfer account:"); icicisave.Transfer(amount, ); } else if (acctype == 0 && bankk == 1) { Console.WriteLine("Enter the deposit amount:"); double amount = double.Parse(Console.ReadLine()); hsbcsave.Deposit(amount); } break; case 2: if (acctype == 0 && bankk == 0) { // var icsave = new LQ5LibraryProject.ICICI(); Console.WriteLine("Enter the withdraw amount:"); double amount = double.Parse(Console.ReadLine()); bool result = icicisave.Withdraw(amount); Console.WriteLine("balance is:" + result); } else if (acctype == 0 && bankk == 1) { Console.WriteLine("Enter the deposit amount:"); double amount = double.Parse(Console.ReadLine()); bool result = hsbcsave.Withdraw(amount); Console.WriteLine("balance is:" + result); } break; case 3: if (acctype == 0 && bankk == 0) { icicisave.GetBalance(); } if (acctype == 0 && bankk == 1) { hsbcsave.GetBalance(); } break; } } while (j != 4); break; case 1: var icicicurr = new LQ5LibraryProject.ICICI(); var hsbccurr = new LQ5LibraryProject.HSBC(); IBankAccount bankAccountinterfaceicicicurr = new ICICI(); IBankAccount bankAccountinterfacehsbccurr = new HSBC(); arrayList.Add(bankAccountinterfaceicicicurr); arrayList.Add(bankAccountinterfacehsbccurr); do { Console.WriteLine("select function:"); fucntionss(); j = int.Parse(Console.ReadLine()); switch (j) { case 0: if (acctype == 0 && bankk == 0) { // var icsave = new LQ5LibraryProject.ICICI(); Console.WriteLine("Enter the deposit amount:"); double amount = double.Parse(Console.ReadLine()); double result = icicicurr.Deposit(amount); Console.WriteLine("balance is:" + result); } else if (acctype == 0 && bankk == 1) { Console.WriteLine("Enter the deposit amount:"); double amount = double.Parse(Console.ReadLine()); double result = hsbccurr.Deposit(amount); Console.WriteLine("balance is:" + result); } break; case 1: if (acctype == 0 && bankk == 0) { Console.WriteLine("Enter the deposit amount:"); double amount = double.Parse(Console.ReadLine()); icicicurr.Deposit(amount); } else if (acctype == 0 && bankk == 1) { Console.WriteLine("Enter the deposit amount:"); double amount = double.Parse(Console.ReadLine()); foreach (var item in arrayList) { Console.WriteLine("select account:" + item); } int varr = int.Parse(Console.ReadLine()); // hsbccurr.Transfer(amount,IBankAccount.); } break; case 2: if (acctype == 0 && bankk == 0) { Console.WriteLine("Enter the withdraw amount:"); double amount = double.Parse(Console.ReadLine()); bool result = icicicurr.Withdraw(amount); Console.WriteLine("balance is:" + result); } else if (acctype == 0 && bankk == 1) { Console.WriteLine("Enter the deposit amount:"); double amount = double.Parse(Console.ReadLine()); bool result = hsbccurr.Withdraw(amount); Console.WriteLine("balance is:" + result); } break; case 3: if (acctype == 0 && bankk == 0) { icicicurr.GetBalance(); } if (acctype == 0 && bankk == 1) { hsbccurr.GetBalance(); } break; } } while (j != 4); //if (acctype == 1 && bankk == 0) { // Console.WriteLine("Enter the deposit amount:"); // double amount = double.Parse(Console.ReadLine()); // icicicurr.Deposit(amount); //} //if (acctype == 1 && bankk == 1) { var hsbccurr = new LQ5LibraryProject.HSBC(); //} break; case 2: Console.Write("Exit from acctype"); break; } } while (acctype != 2); } } while (bankk != 2); }