コード例 #1
0
ファイル: Receipt.cs プロジェクト: linksdeity/MidTerm
        public static void PrintReceipt(int grandTotal, List <Product> ShoppingCart, string cardNumber, string expiration)
        {
            Console.Clear();

            Console.WriteLine("Thank you for shopping with MALOMART!\nYou have purchased the following items...\n\n");

            Console.WriteLine(Itemizer.CountDuplicates(ShoppingCart));

            char[] cardLastFour = new char[4];

            cardLastFour[0] = cardNumber[(cardNumber.Length - 4)];
            cardLastFour[1] = cardNumber[(cardNumber.Length - 3)];
            cardLastFour[2] = cardNumber[(cardNumber.Length - 2)];
            cardLastFour[3] = cardNumber[(cardNumber.Length - 1)];

            Console.WriteLine("You payed with a card, ending in: " + cardLastFour[0] + cardLastFour[1] + cardLastFour[2] + cardLastFour[3]);

            int total = Itemizer.GetTotal(ShoppingCart);

            Console.WriteLine("\nTotal before tax: " + total);
            Console.WriteLine("\nGRAND TOTAL: " + grandTotal);

            Console.WriteLine("\nPress anything to return to the main menu");
            ShoppingCart.Clear();
            Console.ReadKey(true);
            Console.Clear();
        }
コード例 #2
0
ファイル: CheckOut.cs プロジェクト: linksdeity/MidTerm
        public static void ReviewCart(List <Product> ShoppingCart)
        {
            Console.Clear();

            //show list of items currently in the cart
            Console.WriteLine("Your cart currently contains...\n\n");

            Console.WriteLine(Itemizer.CountDuplicates(ShoppingCart));


            //get prices with tax, subtotal and toal
            int cartKeeper = Itemizer.GetTotal(ShoppingCart);

            Console.WriteLine("\nSub Total: {0}", cartKeeper);

            int grandTotal = (int)(cartKeeper + (cartKeeper * 0.06));

            Console.WriteLine("\nSales Tax: {0}", (grandTotal - cartKeeper));

            Console.WriteLine("\nGrand Total: {0} (after 6% tax)", grandTotal);

            if (ShoppingCart.Count == 0)
            {
                Console.WriteLine("\n\nYour cart is empty, press any key to return to the main menu!");
                Console.ReadKey(true);
                Console.Clear();
                return;
            }

            //give option to clear cart or move to payment
            Console.WriteLine("\nWould you like to 'c'heck out, or would you like to  go back to main 'm'enu or clear your 's'hopping cart?");

            char choice = Validator.GetAnyCaseChar("\npress 'c' to 'c'heck out\npress 's' to clear your 's'hopping cart\npress 'm' to go back to the main 'm'enu.", new char[] { 'c', 's', 'm' }, new char[] { 'C', 'S', 'M' });


            if (choice == 'c')
            {
                Payment.CheckingOut(grandTotal, ShoppingCart);
            }
            else if (choice == 'm')
            {
                Console.Clear();
                return;
            }
            else if (choice == 's')
            {
                ShoppingCart.Clear();
                Console.Clear();
                Console.WriteLine("Emptied cart, returning to main menu!");
                Console.ReadKey(true);
                Console.Clear();
                return;
            }
        }
コード例 #3
0
ファイル: Receipt.cs プロジェクト: linksdeity/MidTerm
        public static void PrintReceipt(int grandTotal, List <Product> ShoppingCart, string checkNumber)
        {
            Console.Clear();

            Console.WriteLine("Thank you for shopping with MALOMART!\nYou have purchased the following items...\n\n");

            Console.WriteLine(Itemizer.CountDuplicates(ShoppingCart));

            Console.WriteLine("You payed with a check or bank account, number: " + checkNumber);

            int total = Itemizer.GetTotal(ShoppingCart);

            Console.WriteLine("\nTtotal before tax: " + total);
            Console.WriteLine("\nGRAND TOTAL: " + grandTotal);

            Console.WriteLine("\nPress anything to return to the main menu");
            ShoppingCart.Clear();
            Console.ReadKey(true);
            Console.Clear();
        }
コード例 #4
0
ファイル: Receipt.cs プロジェクト: linksdeity/MidTerm
        public static void PrintReceipt(int grandTotal, List <Product> ShoppingCart, int amount, int change)
        {
            Console.Clear();

            Console.WriteLine("Thank you for shopping with MALOMART!\nYou have purchased the following items...\n\n");

            Console.WriteLine(Itemizer.CountDuplicates(ShoppingCart));

            Console.WriteLine("You payed with Rupees in the amount of: {0}", amount);

            int total = Itemizer.GetTotal(ShoppingCart);

            Console.WriteLine("\nTotal before tax: " + total);
            Console.WriteLine("\nGRAND TOTAL: " + grandTotal);

            Console.WriteLine("\n\nYou are receiving {0} Rupees in change", change);

            Console.WriteLine("\nPress anything to return to the main menu");
            ShoppingCart.Clear();
            Console.ReadKey(true);
            Console.Clear();
        }