Example #1
0
        static void Main(string[] args)
        {
            CardFactory factory = null;

            Console.Write("Enter the card type you would like to visit: ");
            string car = Console.ReadLine();

            switch (car.ToLower())
            {
            case "moneyback":
                factory = new MoneyBackFactory(50000, 0);
                break;

            case "titanium":
                factory = new TitaniumFactory(100000, 500);
                break;

            case "platinum":
                factory = new PlatinumFactory(500000, 1000);
                break;

            default:
                break;
            }

            CreditCard creditCard = factory?.GetCreditCard();

            Console.WriteLine("\nYour card details are below : \n");
            Console.WriteLine($"Card Type: {creditCard?.CardType}\nCredit Limit: {creditCard?.CreditLimit}\nAnnual Charge: {creditCard?.AnnualCharge}");
            Console.ReadKey();
        }
Example #2
0
        static void Main()
        {
            CardFactory factory = null;

            Console.WriteLine("Enter köp");
            int saldo = Convert.ToInt32(Console.ReadLine());

            Console.Write("Enter the card type you would like to have: ");
            string card = Console.ReadLine();


            switch (card.ToLower())
            {
            case "debit":
                factory = new DebitFactory(5000, saldo);
                break;

            case "titanium":
                factory = new TitaniumFactory(10000, saldo);
                break;

            case "platinum":
                factory = new PlatinumFactory(50000, saldo);
                break;

            default:
                break;
            }

            CreditCard creditCard = factory.GetCreditCard();

            Console.WriteLine("\nYour card details are below : \n");
            Console.WriteLine("Card Type: {0}\nCredit Limit: {1}\nAnnual Charge: {2}",
                              creditCard.CardType, creditCard.CreditLimit, creditCard.AnnualCharge);
            Console.WriteLine("To close press the enter");
            Console.ReadKey();
        }