Beispiel #1
0
        public void DisplayCheck(Total T)
        {
            Console.Write("\nPlease enter a check number: ");
            int         checkNumber = int.Parse(Console.ReadLine());
            PaymentType pt          = new PaymentType(checkNumber);

            Console.WriteLine("\nPayment Type: Check");
            Console.WriteLine("Check number: " + pt.CheckNumber);
            Console.WriteLine("Amount Tendered: " + T.GrandTotal.ToString("C", CultureInfo.CurrentCulture));
        }
Beispiel #2
0
        public void DisplayCreditCard(Total T)
        {
            Console.Write("\nPlease enter a credit card number: ");
            string creditCardNum = Console.ReadLine();

            Console.Write("Enter credit card expiration month (MM): ");
            string expiryMonth = Console.ReadLine();

            Console.Write("Enter credit card expiration year (YYYY): ");
            string expiryYear = Console.ReadLine();

            Console.Write("Enter credit card security code (CVV): ");
            int         creditCardCVV = int.Parse(Console.ReadLine());
            PaymentType pt            = new PaymentType(creditCardNum, expiryMonth, expiryYear, creditCardCVV);

            Console.WriteLine("\nPayment Type: Credit Card");
            Console.WriteLine("Credit Card Number: " + pt.CreditCardNum);
            Console.WriteLine("Credit Card Expiration Month/Year: " + pt.ExpiryMonth + "/" + pt.ExpiryYear);
            Console.WriteLine("Credit Card CVV: " + pt.CreditCardCVV);
            Console.WriteLine("Amount Tendered: " + T.GrandTotal.ToString("C", CultureInfo.CurrentCulture));
        }
Beispiel #3
0
        public void PaymentMenu(Total t)
        {
            Console.WriteLine("Payment Options");
            Console.WriteLine("-".PadRight(100, '-'));
            Console.WriteLine("1.) Cash");
            Console.WriteLine("2.) Check");
            Console.WriteLine("3.) Credit Card");

            bool isPaymentOption = true;

            do
            {
                Console.Write("\nPlease select your preferred method of payment (1-3): ");

                int             input = int.Parse(Console.ReadLine());
                PaymentTypeView pv    = new PaymentTypeView();
                if (input == 1)
                {
                    pv.DisplayCash(t);
                    isPaymentOption = true;
                }
                else if (input == 2)
                {
                    pv.DisplayCheck(t);
                    isPaymentOption = true;
                }
                else if (input == 3)
                {
                    pv.DisplayCreditCard(t);
                    isPaymentOption = true;
                }

                else
                {
                    Console.WriteLine("Invalid input. Please try again.");
                    isPaymentOption = false;
                }
            } while (isPaymentOption == false);
            Console.WriteLine("-".PadRight(100, '-'));
        }
Beispiel #4
0
        // Create instance of Payment Type to access properties & an instance of Total to access properties
        // public Total T = new Total();

        // Create a display method for each payment type
        public void DisplayCash(Total T)
        {
            Console.Write("\nEnter cash value to be tendered: ");
            double cashValue = double.Parse(Console.ReadLine());

            while (true)
            {
                if (cashValue < T.GrandTotal)
                {
                    Console.WriteLine("The amount paid was not sufficient to cover the cost. Please try again.");
                    cashValue = double.Parse(Console.ReadLine());
                }
                else
                {
                    break;
                }
            }

            PaymentType pt = new PaymentType(cashValue);

            Console.WriteLine("\nPayment Type: Cash");
            Console.WriteLine("Cash Value Tendered: " + pt.CashValue.ToString("C", CultureInfo.CurrentCulture));
            Console.WriteLine("Change: " + (pt.CashValue - T.GrandTotal).ToString("C", CultureInfo.CurrentCulture));
        }