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

            Console.WriteLine("Digite o tipo de cartão que gostaria de obter: ");
            string console = Console.ReadLine();

            switch (console.ToLower())
            {
            case "black":
                cartaoFactory = new BlackFactory(50000, 0);
                break;

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

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

            default:
                break;
            }

            CartaoCredito cartaoCredito = cartaoFactory.BuscarCartaoCredito();

            Console.WriteLine("\nOs detalhes do seu cartão estão abaixo: \n");
            Console.WriteLine("Tipo do cartão: {0}\nCrédito limite: {1}\nCobrança anual: {2}",
                              cartaoCredito.TipoCartao, cartaoCredito.LimiteCredito, cartaoCredito.CobrancaAnual);
            Console.ReadKey();
        }
Example #2
0
        public static void Run()
        {
            ICreditCard creditCard = new PlatinumFactory().CreateProduct();

            if (creditCard != null)
            {
                Console.WriteLine("Card Type : " + creditCard.GetCardType());
                Console.WriteLine("Credit Limit : " + creditCard.GetCreditLimit());
                Console.WriteLine("Annual Charge :" + creditCard.GetAnnualCharge());
            }
            else
            {
                Console.Write("Invalid Card Type");
            }
            Console.WriteLine("--------------");
            creditCard = new MoneyBackFactory().CreateProduct();
            if (creditCard != null)
            {
                Console.WriteLine("Card Type : " + creditCard.GetCardType());
                Console.WriteLine("Credit Limit : " + creditCard.GetCreditLimit());
                Console.WriteLine("Annual Charge :" + creditCard.GetAnnualCharge());
            }
            else
            {
                Console.Write("Invalid Card Type");
            }
            Console.ReadLine();
        }
Example #3
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.GetCreditCart();

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