Пример #1
0
        public static void GetPaymentType()
        {
            Console.WriteLine("How would you like to pay for your item(s)? [1] Cash, [2] Credit, or [3] Check?");
            string userInput = Console.ReadLine().ToLower();

            switch (userInput)
            {
            case "1":
            case "cash":
                AmountTendered = GetCashPayment();
                Change         = SubtotalBill.GetChange(AmountTendered, Streams.InstatiateGrandTotal());
                PaymentType    = "Cash";
                break;

            case "2":
            case "credit":
                CreditCard.ValidateCreditCardInfo();
                PaymentType    = "Credit";
                AmountTendered = Streams.InstatiateGrandTotal();
                break;

            case "3":
            case "check":
                GetCheckNumber();
                PaymentType    = "Check";
                AmountTendered = Streams.InstatiateGrandTotal();
                break;

            default:
                Console.WriteLine("Please enter a valid selection.");
                GetPaymentType();
                break;
            }
        }
Пример #2
0
        public static void GetPaymentType()
        {
            Console.WriteLine("How would you like to pay for your item(s)? [1] Cash, [2] Credit, or [3] Check?");
            string userInput = Console.ReadLine();

            if (userInput == "1" || userInput.Equals("cash", StringComparison.OrdinalIgnoreCase))
            {
                decimal change = (decimal)SubtotalBill.GetChange(GetCashPayment(), SubtotalBill.GetGrandTotal(1, 2));
                Console.WriteLine($"Change due: ${change} ");
            }
            else if (userInput == "2" || userInput.Equals("credit", StringComparison.OrdinalIgnoreCase))
            {
                ValidateCreditCardInfo();
            }
            else if (userInput == "3" || userInput.Equals("check", StringComparison.OrdinalIgnoreCase))
            {
                GetCheckNumber();
            }
        }