public void StartWithdraw(decimal amount, string currency) { Console.WriteLine("1. CreditCard"); Console.WriteLine("2. Privet48"); Console.WriteLine("3. Stereobank"); string n = Console.ReadLine(); CreditCard card; Privet48 privet; Stereobank stereo; switch (n) { case "1": card = new CreditCard(); card.StartWithdrawal(amount, currency); break; case "2": privet = new Privet48(); privet.StartWithdrawal(amount, currency); break; case "3": stereo = new Stereobank(); stereo.StartWithdrawal(amount, currency); break; default: Console.WriteLine("You entered wrong number, pls enter 1, 2 or 3"); break; } }
static void Main(string[] args) { var creditCard = new CreditCard(); var privet48 = new Privet48(); var stereobank = new Stereobank(); var giftVoucher = new GiftVoucher(); creditCard.StartDeposit(50, "USD"); creditCard.StartWithdrawal(50, "USD"); privet48.StartDeposit(50, "USD"); stereobank.StartWithdrawal(50, "USD"); giftVoucher.StartDeposit(50, "USD"); giftVoucher.StartDeposit(500, "USD"); giftVoucher.StartDeposit(50, "USD"); }
static void Main(string[] args) { CreditCard creditCard = new CreditCard(); Privet48 privet48 = new Privet48(); Stereobank stereobank = new Stereobank(); GiftVoucher giftVoucher = new GiftVoucher(); creditCard.StartDeposit(50, "USD"); creditCard.StartWithdrawal(50, "USD"); privet48.StartDeposit(50, "USD"); stereobank.StartWithdrawal(50, "USD"); try { giftVoucher.StartDeposit(50, "USD"); } catch (InvalidOperationException e) { Console.WriteLine(e.Message); } giftVoucher.StartDeposit(500, "USD"); }