Ejemplo n.º 1
0
        static void Main(string[] args)
        {
            List <Product> wholeOrder = default;

            UserInterface.GreetUser();
            Streams.DisplayMenuToUser();

            bool keepGoing = true;

            while (keepGoing)
            {
                UserInterface.AskForOrder();
                wholeOrder = Streams.AddToOrderList(Streams.ValidateUserInput());
                Console.WriteLine("Would you like to order anything else? (y/n)");
                string userInput = Console.ReadLine().ToLower();
                if (userInput == "n")
                {
                    keepGoing = false;
                }


                Console.WriteLine($"Your subtotal is {Payments.PrintDollar((SubtotalBill.SubTotalGetter(wholeOrder)))}");
                Console.WriteLine($"Your grand total is {Payments.PrintDollar((SubtotalBill.GrandTotalGetter(wholeOrder)))}");
                Payments.GetPaymentType();
                Receipt.DisplayReceipt();
            }
        }
Ejemplo n.º 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().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;
            }
        }
Ejemplo n.º 3
0
        public static void DisplayReceipt()
        {
            var dateTime = DateTime.Now;

            Console.WriteLine("==========================");
            Console.WriteLine("         RECEIPT     ");
            Console.WriteLine("==========================");
            Console.WriteLine($"{dateTime}");
            Console.WriteLine("");
            Console.WriteLine("Items Ordered: (this is where product and qty will go)");
            Console.WriteLine($"Subtotal: ${SubtotalBill.GetSubtotal(1,2)}");
            Console.WriteLine($"Grand Total: ${SubtotalBill.GetGrandTotal(1,2)}");
            //need to put if client pays with cash, credit, card
        }
Ejemplo n.º 4
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();
            }
        }
Ejemplo n.º 5
0
        public static void DisplayReceipt()
        {
            var dateTime = DateTime.Now;

            Console.WriteLine("");
            Console.WriteLine("==========================");
            Console.WriteLine("         RECEIPT     ");
            Console.WriteLine("==========================");
            Console.WriteLine($"{dateTime}");
            Console.WriteLine("");
            Console.WriteLine($"{Streams.PrintOutOrder()}");
            Console.WriteLine($"Subtotal: {Payments.PrintDollar(Streams.InstatiateSubTotal())}");
            Console.WriteLine($"Total tax: {Payments.PrintDollar(SubtotalBill.TotalTax())}");
            Console.WriteLine($"Grand total: {Payments.PrintDollar((Streams.InstatiateGrandTotal()))}");
            Console.WriteLine("");
            Console.WriteLine($"Payment type: {Payments.PaymentType}");
            Console.WriteLine($"Amount tendered: {Payments.PrintDollar(Payments.AmountTendered)}");
            Console.WriteLine($"Change due: {Payments.PrintDollar(Payments.Change)}");
            Console.WriteLine("==========================");
            Console.WriteLine("Thank you! Please come again!");
        }
Ejemplo n.º 6
0
        public static double InstatiateSubTotal()
        {
            double subTotal = SubtotalBill.SubTotalGetter(wholeOrder);

            return(subTotal);
        }
Ejemplo n.º 7
0
        public static double InstatiateGrandTotal()
        {
            double grandTotal = SubtotalBill.SubTotalGetter(wholeOrder) * 1.06;

            return(grandTotal);
        }