示例#1
0
        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;
            }
        }
示例#2
0
        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");
        }
示例#3
0
        static void Main(string[] args)
        {
            CreditCard creditCard = new CreditCard();

            creditCard.StartDeposit(50, "USD");
            creditCard.StartDeposit(50, "USD");
            Privet48 privet48 = new Privet48();

            privet48.StartDeposit(50, "USD");
            Stereobank stereobank = new Stereobank();

            stereobank.StartDeposit(50, "USD");
            GiftVoucher giftVoucher = new GiftVoucher();

            giftVoucher.StartDeposit(50, "USD");
            giftVoucher.StartDeposit(500, "USD");
        }
示例#4
0
文件: Program.cs 项目: trol80lvl2/HW2
        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");
        }
示例#5
0
        public void StartDeposit(decimal amount, string currency)
        {
            Console.WriteLine("1. CreditCard");
            Console.WriteLine("2. Privet48");
            Console.WriteLine("3. Stereobank");
            Console.WriteLine("4. GiftVoucher");
            string n = Console.ReadLine();

            CreditCard  card;
            Privet48    privet;
            Stereobank  stereo;
            GiftVoucher gift;

            switch (n)
            {
            case "1":
                card = new CreditCard();
                card.StartDeposit(amount, currency);
                break;

            case "2":
                privet = new Privet48();
                privet.StartDeposit(amount, currency);
                break;

            case "3":
                stereo = new Stereobank();
                stereo.StartDeposit(amount, currency);
                break;

            case "4":
                gift = new GiftVoucher();
                gift.StartDeposit(amount, currency);
                break;

            default:
                Console.WriteLine("You entered wrong number, pls enter 1, 2, 3 or 4");
                break;
            }
        }