private static double BankFactory(int amount, int bankType) { IBank[] randomBank = new IBank[2]; randomBank[0] = new BankOne(); randomBank[1] = new BankTwo(); Random random = new Random(); var pick = random.Next(3); IBank bank = null; switch (bankType) { case 1: bank = new BankOne(); break; case 2: bank = new BankTwo(); break; default: bank = randomBank[pick - 1]; break; } return(bank.GetCharge(amount)); }