static void Main(string[] args) { Bank <Account> bank = new Bank <Account>("UnitBank"); bool alive = true; while (alive) { ConsoleColor color = Console.ForegroundColor; Console.ForegroundColor = ConsoleColor.DarkGreen; Console.WriteLine("1. Open account \t 2. Withdraw money \t 3. Add money to account"); Console.WriteLine("4. Close account \t 5. Skip day \t 6. Exit program"); Console.WriteLine("7. Show account balance "); Console.ForegroundColor = color; try { int command = Convert.ToInt32(Console.ReadLine()); switch (command) { case 1: OpenAccount(bank); break; case 2: Withdraw(bank); break; case 3: Put(bank); break; case 4: CloseAccount(bank); break; case 5: break; case 6: alive = false; break; case 7: ShowBalance(bank); continue; } bank.CalculatePercentage(); } catch (Exception ex) { color = Console.ForegroundColor; Console.ForegroundColor = ConsoleColor.Red; Console.WriteLine(ex.Message); Console.ForegroundColor = color; } } }
static void Main(string[] args) { Bank <Account> bank = new Bank <Account>("UnitBank"); bool alive = true; while (alive) { ConsoleColor color = Console.ForegroundColor; Console.ForegroundColor = ConsoleColor.DarkGreen; // выводим список команд зеленым цветом Console.WriteLine("1. Open Account \t 2. Withdraw money \t 3. Top up account"); Console.WriteLine("4. Close Account \t 5. Display accounts \t 6. Skip day \t 7.Exit"); Console.WriteLine("Enter your choice:"); Console.ForegroundColor = color; try { int command = Convert.ToInt32(Console.ReadLine()); switch (command) { case 1: OpenAccount(bank); break; case 2: Withdraw(bank); break; case 3: Put(bank); break; case 4: CloseAccount(bank); break; case 5: ShowAllAccounts(bank); break; case 6: break; case 7: alive = false; continue; } bank.CalculatePercentage(); } catch (Exception ex) { color = Console.ForegroundColor; Console.ForegroundColor = ConsoleColor.Red; Console.WriteLine(ex.Message); Console.ForegroundColor = color; } } }
static void Main(string[] args) { Bank <Account> bank = new Bank <Account>("DreamBank"); bool alive = true; while (alive) { Console.Clear(); bank.CalculatePercentage(); ConsoleColor defaultColor = Console.ForegroundColor; Console.ForegroundColor = ConsoleColor.DarkGreen; Console.WriteLine($"День: {bank.Day}"); Console.WriteLine("1. Открыть счёт \t 2. Вывести средства \t 3. Внести средства"); Console.WriteLine("4. Закрыть счёт \t 5. Пропустить день \t 6. Выйти из программы"); Console.WriteLine("Введите номер пункта: "); Console.ForegroundColor = defaultColor; try { int command = Convert.ToInt32(Console.ReadLine()); switch (command) { case 1: OpenAccount(bank); break; case 2: Withdraw(bank); break; case 3: Put(bank); break; case 4: Close(bank); break; case 5: break; case 6: alive = false; continue; } } catch (Exception ex) { { Console.ForegroundColor = ConsoleColor.Red; Console.WriteLine(ex.Message); Console.ForegroundColor = defaultColor; } } } }
static void Main(string[] args) { Bank <Account> bank = new Bank <Account> ("Bank"); bool alive = true; while (alive) { ConsoleColor color = Console.ForegroundColor; Console.ForegroundColor = ConsoleColor.DarkGreen; Console.WriteLine("\n1. Open account \t 2. Withdraw funds \t 3. Add funds"); Console.WriteLine("4. Close the account \t 5. Skip the day \t 6. Exit the program"); Console.Write("\nSpecify the desired item: "); Console.ForegroundColor = color; try { int command = Convert.ToInt32(Console.ReadLine()); switch (command) { case 1: OpenAccount(bank); break; case 2: Withdraw(bank); break; case 3: Put(bank); break; case 4: CloseAccount(bank); break; case 5: break; case 6: alive = false; continue; } bank.CalculatePercentage(); } catch (Exception ex) { //Display error message in red color = Console.ForegroundColor; Console.ForegroundColor = ConsoleColor.Red; Console.WriteLine(ex.Message); Console.ForegroundColor = color; } } }
static void Main(string[] args) { Console.OutputEncoding = System.Text.Encoding.UTF8; Console.InputEncoding = System.Text.Encoding.UTF8; Bank <Account> bank = new Bank <Account>("ЮнитБанк"); bool alive = true; while (alive) { ConsoleColor color = Console.ForegroundColor; Console.ForegroundColor = ConsoleColor.DarkGreen; // выводим список команд зеленым цветом Console.WriteLine("1. Открыть счет \t 2. Вывести средства \t 3. Добавить на счет"); Console.WriteLine("4. Закрыть счет \t 5. Пропустить день \t 6. Выйти из программы"); Console.WriteLine("Введите номер пункта:"); Console.ForegroundColor = color; try { int command = Convert.ToInt32(Console.ReadLine()); switch (command) { case 1: OpenAccount(bank); break; case 2: Withdraw(bank); break; case 3: Put(bank); break; case 4: CloseAccount(bank); break; case 5: break; case 6: alive = false; continue; } bank.CalculatePercentage(); } catch (Exception ex) { // выводим сообщение об ошибке красным цветом color = Console.ForegroundColor; Console.ForegroundColor = ConsoleColor.Red; Console.WriteLine(ex.Message); Console.ForegroundColor = color; } } }
static void Main(string[] args) { Bank <Account> bank = new Bank <Account>("ЮнитБанк"); bool alive = true; while (alive) { ConsoleColor color = Console.ForegroundColor; Console.ForegroundColor = ConsoleColor.DarkGreen; //show command list in green color Console.WriteLine("1. Открыть счет \t 2. Вывести средства \t 3. Добавить на счет"); Console.WriteLine("4. Закрыть счет \t 5. Пропустить день \t 6. Выйти из программы"); Console.WriteLine("Введите номер пункта:"); Console.ForegroundColor = color; try { int command = Convert.ToInt32(Console.ReadLine()); switch (command) { case 1: OpenAccount(bank); break; case 2: Withdraw(bank); break; case 3: Put(bank); break; case 4: CloseAccount(bank); break; case 5: break; case 6: alive = false; continue; } bank.CalculatePercentage(); } catch (Exception ex) { //show error message in red color color = Console.ForegroundColor; Console.ForegroundColor = ConsoleColor.Red; Console.WriteLine(ex.Message); Console.ForegroundColor = color; } } }
static void Main(string[] args) { Bank <Account> bank = new Bank <Account>("SolutionBank"); bool alive = true; while (alive) { ConsoleColor color = Console.ForegroundColor; Console.ForegroundColor = ConsoleColor.DarkBlue;//Otput komands list blue color Console.WriteLine("1. Open account \t 2. Output monet \t 3. Add to account"); Console.WriteLine("4. Clouse account \t 5. lose the day \t 6. Exit from programm"); Console.WriteLine("Enter the item number: "); Console.ForegroundColor = color; try { int command = Convert.ToInt32(Console.ReadLine()); switch (command) { case 1: OpenAccount(bank); break; case 2: Withdraw(bank); break; case 3: Put(bank); break; case 4: CloseAccount(bank); break; case 5: break; case 6: alive = false; continue; } bank.CalculatePercentage(); } catch (Exception ex) { //output red color mesage about error color = Console.ForegroundColor; Console.ForegroundColor = ConsoleColor.Red; Console.WriteLine(ex.Message); Console.ForegroundColor = color; } } }
static void Main(string[] args) { Bank <Account> bank = new Bank <Account>("SlavaUkraineBank"); bool alive = true; while (alive) { ConsoleColor color = Console.ForegroundColor; Console.ForegroundColor = ConsoleColor.Green; Console.WriteLine("1. Open an account \n 2. Display cash \n 3. Add to the account\n"); Console.WriteLine("4. Close the account \n 5. Skip the day \n 6. Exit"); Console.WriteLine("Input number of unit:"); Console.ForegroundColor = color; try { int command = Convert.ToInt32(Console.ReadLine()); switch (command) { case 1: OpenAccount(bank); break; case 2: Withdraw(bank); break; case 3: Put(bank); break; case 4: CloseAccount(bank); break; case 5: break; case 6: alive = false; continue; } bank.CalculatePercentage(); } catch (Exception ex) { ///Exception message color = Console.ForegroundColor; Console.ForegroundColor = ConsoleColor.Red; Console.WriteLine(ex.Message); Console.ForegroundColor = color; } } }
static void Main(string[] args) { Bank <Account> bank = new Bank <Account>("ADAbank"); bool alive = true; while (alive) { ConsoleColor color = Console.ForegroundColor; Console.ForegroundColor = ConsoleColor.DarkGreen; Console.WriteLine("1. To open the account \t 2. To withdraw amount \t 3. To put on account"); Console.WriteLine("4. To cloe the account \t 5. Miss the day \t 6. To leave the program"); Console.WriteLine("Enter number"); Console.ForegroundColor = color; try { int command = Convert.ToInt32(Console.ReadLine()); switch (command) { case 1: OpenAccount(bank); break; case 2: Withdraw(bank); break; case 3: Put(bank); break; case 4: CloseAccount(bank); break; case 5: break; case 6: alive = false; continue; } bank.CalculatePercentage(); } catch (Exception ex) { //Display an error message in red color = Console.ForegroundColor; Console.ForegroundColor = ConsoleColor.Red; Console.WriteLine(ex.Message); Console.ForegroundColor = color; } } }
static void Main(string[] args) { Bank <Account> Bank = new Bank <Account>("Сбербанк"); bool Alive = true; while (Alive) { ConsoleColor color = Console.ForegroundColor; Console.ForegroundColor = ConsoleColor.DarkGray; Console.WriteLine("1. Открыть счет \t 2. Вывести средства \t 3. Добавить на счет"); Console.WriteLine("4. Закрыть счет \t 5. Пропустить день \t 6. Выйти из программы"); Console.WriteLine("Введите номер пункта:"); Console.ForegroundColor = color; try { int Command = Convert.ToInt32(Console.ReadLine()); switch (Command) { case 1: OpenAccount(Bank); break; case 2: Withdraw(Bank); break; case 3: Put(Bank); break; case 4: break; case 5: break; case 6: Alive = false; break; } Bank.CalculatePercentage(); } catch (Exception ex) { color = Console.ForegroundColor; Console.ForegroundColor = ConsoleColor.Red; Console.WriteLine($"Неудачная попытка {ex.Message}"); } } }
static void Main(string[] args) { Bank <BankLibrary.Account> bank = new Bank <BankLibrary.Account>("ЮнитБанк"); bool alive = true; while (alive) { Console.WriteLine("1. Открыть счет \t 2. Вывести средства \t 3. Добавить на счет"); Console.WriteLine("4. Закрыть счет \t 5. Пропустить день \t 6. Выйти из программы"); Console.WriteLine("Введите номер пункта:"); try { int command = Convert.ToInt32(Console.ReadLine()); switch (command) { case 1: OpenAccount(bank); break; case 2: Withdraw(bank); break; case 3: Put(bank); break; case 4: CloseAccount(bank); break; case 5: Clear(); break; case 6: alive = false; continue; } bank.CalculatePercentage(); } catch (Exception ex) { Clear(); Console.WriteLine(ex.Message); } } }
protected void ButtonNextDayClicked(object sender, EventArgs a) { bank.CalculatePercentage(); }
private static void Main(string[] args) { Bank <Account> Unitbank = new Bank <Account>("ЮнитБанк"); bool alive = true; while (alive) { ConsoleColor color = ForegroundColor; ForegroundColor = ConsoleColor.DarkGreen; WriteLine("1. Открыть счет. \t 2. Вывести средства. \t 3. Добавить на счет."); WriteLine("4. Закрыть счет. \t 5. Пропустить день. \t 6. Выйти из программы."); WriteLine("Введите номер пункта: "); ForegroundColor = color; try { int command = Convert.ToInt32(ReadLine()); switch (command) { case 1: { OpenAccount(Unitbank); break; } case 2: { Withdraw(Unitbank); break; } case 3: { Put(Unitbank); break; } case 4: { CloseAccount(Unitbank); break; } case 5: { break; } case 6: { alive = false; continue; } } Unitbank.CalculatePercentage(); } catch (Exception exeption) { color = ForegroundColor; ForegroundColor = ConsoleColor.Red; WriteLine(exeption.Message); ForegroundColor = color; } } }
static void Main(string[] args) { Bank <Account> bank = new Bank <Account>("SATBank"); bool active = true; while (active) { ConsoleColor consoleColor = Console.ForegroundColor; Console.ForegroundColor = ConsoleColor.DarkGreen; Console.WriteLine("1 - Открыть счет."); Console.WriteLine("2 - Вывести средства."); Console.WriteLine("3 - Пополнить счет."); Console.WriteLine("4 - Закрыть счет."); Console.WriteLine("5 - Пропустить день."); Console.WriteLine("6 - Выйти из программы."); Console.WriteLine("Введите номер пункта!"); Console.ForegroundColor = consoleColor; try { int command = Convert.ToInt32(Console.ReadLine()); switch (command) { case 1: { OpenAccount(bank); break; } case 2: { Withdraw(bank); break; } case 3: { Put(bank); break; } case 4: { CloseAccount(bank); break; } case 5: { break; } case 6: { active = false; break; } } bank.CalculatePercentage(); } catch (Exception ex) { consoleColor = Console.ForegroundColor; Console.ForegroundColor = ConsoleColor.Red; Console.WriteLine(ex.Message); Console.ForegroundColor = consoleColor; } } }