public static void CreditCard(List <FoodItem> order) { decimal orderTotal = OrderOptions.GetTotalCost(order, OrderOptions.taxPercentageDecimal); Console.WriteLine($"You are paying {String.Format("{0:C}", orderTotal)} by credit card. Please enter your credit card number:"); string ccNum = Validation.CreditCardVal(Console.ReadLine()); int secCode; if (ccNum[0] == 3) { Console.WriteLine("Please enter the 4 digit security code on the front of your card."); secCode = Validation.SecurityCodeVal(Console.ReadLine(), 4); } else { Console.WriteLine("Please enter the 3 digit security code on the back of your card."); secCode = Validation.SecurityCodeVal(Console.ReadLine(), 3); } Console.WriteLine("Please enter the expiration date in format MM/YYYY:"); string ccExp = Validation.DateVal(Console.ReadLine()); Console.WriteLine("Thank you!"); OrderOptions.ListCurrentOrderDetails(order, " Receipt "); Console.WriteLine($"{String.Format("{0:C}", orderTotal)} has been paid via your credit card: \n"); Console.WriteLine($"{"Card Number:",20}{ccNum,25}"); Console.WriteLine($"{"Security Code:",20}{secCode,25}"); Console.WriteLine($"{"Expiration Date:",20}{ccExp,25}\n"); Console.WriteLine("Have a great day!\n"); }
public static void Check(List <FoodItem> order) { decimal orderTotal = OrderOptions.GetTotalCost(order, OrderOptions.taxPercentageDecimal); Console.WriteLine($"You are paying {String.Format("{0:C}", orderTotal)} by check. Please enter your 9 digit bank routing number:"); double routingNum = Validation.CheckNumsVal(Console.ReadLine(), 12); Console.WriteLine("\nPlease enter your bank account number:"); double acctNum = Validation.CheckNumsVal(Console.ReadLine(), 12); Console.WriteLine("\nPlease enter the check number:"); double checkNum = Validation.CheckNumsVal(Console.ReadLine(), 20); OrderOptions.ListCurrentOrderDetails(order, " Receipt "); Console.WriteLine($"{String.Format("{0:C}", orderTotal)} has been paid via check: \n"); Console.WriteLine($"{"Check Details:",14}{$" {routingNum} {acctNum} {checkNum}",31}"); Console.WriteLine("\nHave a great day!\n"); }
public static void Cash(List <FoodItem> order) { //List Receipt decimal orderTotal = OrderOptions.GetTotalCost(order, OrderOptions.taxPercentageDecimal); decimal moneyTendered = 0; while (moneyTendered < orderTotal) { Console.WriteLine("\nHow much cash are you paying?"); moneyTendered = moneyTendered + (Convert.ToDecimal(Validation.NumberVal(Console.ReadLine()))); if (moneyTendered > orderTotal) { Console.WriteLine($"Thank you! You've paid {String.Format("{0:C}", moneyTendered)}.\n" + $"Your change is {String.Format("{0:C}", moneyTendered - orderTotal)}\n" + $"Have a great day!\n"); } else if (moneyTendered == orderTotal) { Console.WriteLine($"Thank you! You've paid {String.Format("{0:C}", moneyTendered)}.\n" + $"Have a great day!\n"); } else { Console.WriteLine($"Thank you! You've paid {String.Format("{0:C}", moneyTendered)}.\n" + $"You still have {String.Format("{0:C}", orderTotal - moneyTendered)} left on this order."); } if (moneyTendered >= orderTotal) { OrderOptions.ListCurrentOrderDetails(order, " Receipt "); Console.WriteLine($"\n{"Money Tendered:",39}{String.Format("{0:C}", moneyTendered),6}\n"); Console.WriteLine($"{"Change:",39}{String.Format("{0:C}", moneyTendered - orderTotal),6}\n"); } } }
public static void OrderMenu(Dictionary <string, FoodItem> foodDictionary) { List <FoodItem> userOrder = new List <FoodItem>(); bool killswitch = true; while (killswitch) { //Console.WriteLine("\nWhat would you like to do?\n" + // "1. Add an item to your order\n" + // "2. View Your Order\n" + // "3. View the Menu\n" + // "4. Check Out\n" + // "5. Cancel order and go back to main menu.\n"); Console.Clear(); Console.WriteLine(@" ...................................................................... |,---. . ,-. . . ,--. ,-. . | | | | / | | | / | | | | |-. ,-. | |-. ,-: |- --- |- | |-. ,-. ,-. ,-. ,-.| | | | | |-' \ | | | | | | \ | | |-' |-' `-. |-'| | ' ' ' `-' `-' ' ' `-` `-' `--' `-' ' ' `-' `-' `-' `-'| |....................................................................| | : : : :::#:#:#:#:##:##:######:#####:#############|________|________| | : : : :::#:#:#:#:##:##:######:#####:#############| | | | : : : : : ::#:#:#:#:#:##:###:###:#####:##########| | | | : : : (-) :::#:#:#:#:#:#:##:####:###:###:####:##| | | |______.-'-'-.___________________________:####::###|________|________| | |-...-| _______ .--''''''--. \:###:#####:################| | |;:.._| / MENU / |'''''/ | \:# ###| | `-...-' / ==== / '''''/_...--'| \# 1. Add food ###| | /______/ /\ |__...--' \ 2. View order ###| |_________________________/ \_______________\ 3. Look at menu | | | | 4. Check out | | So you want to order some food, eh? | | 5. Never mind. Go | | Hit me. | | back. | |......................................|.|...........................| "); Console.Write("Type a number to make a selection: "); string userOrderMenuInput = Console.ReadLine(); switch (userOrderMenuInput) { case "1": Console.Clear(); OrderOptions.ListFoodMenu(foodDictionary); userOrder = OrderOptions.AddFoodItem(userOrder, foodDictionary); Console.WriteLine("\nPress enter to continue.\n"); string x = Console.ReadLine(); break; case "2": Console.Clear(); OrderOptions.ListCurrentOrderDetails(userOrder, "Your Order"); Console.WriteLine("\nPress enter to continue.\n"); string y = Console.ReadLine(); break; case "3": Console.Clear(); OrderOptions.ListFoodMenu(foodDictionary); Console.WriteLine("\nPress enter to continue.\n"); string z = Console.ReadLine(); break; case "4": Console.Clear(); killswitch = MenusClass.CheckoutMenu(userOrder); break; case "5": Console.WriteLine("Are you sure you want to cancel this transaction? Y/N"); string uSure = Console.ReadLine(); if (uSure.ToUpper() == "Y") { killswitch = false; } break; } } }
public static bool CheckoutMenu(List <FoodItem> order) { while (true) { //Console.WriteLine($"Now checking you out. Your total is {String.Format("{0:C}", OrderOptions.GetTotalCost(order, OrderOptions.taxPercentageDecimal))}\n" + // "Type in a number from the list to:\n" + // "1. Pay by Cash\n" + // "2. Pay by Credit Card\n" + // "3. Pay by Check\n" + // "4. Cancel and go back to your order\n"); //OrderOptions.ListCurrentOrderDetails(order, "Your Order"); Console.WriteLine(@" ...................................................................... |,---. . ,-. . . ,--. ,-. . | | | | / | | | / | | | | |-. ,-. | |-. ,-: |- --- |- | |-. ,-. ,-. ,-. ,-.| | | | | |-' \ | | | | | | \ | | |-' |-' `-. |-'| | ' ' ' `-' `-' ' ' `-` `-' `--' `-' ' ' `-' `-' `-' `-'| |....................................................................| | : : : :::#:#:#:#:##:##:######:#####:#############|________|________| | : : : :::#:#:#:#:##:##:######:#####:#############| | | | : : : : : ::#:#:#:#:#:##:###:###:#####:##########| | | | : : : (-) :::#:#:#:#:#:#:##:####:###:###:####:##| | | |______.-'-'-.___________________________:####::###|________|________| | |-...-| _____ .--''''''--. \:###:#####:################| | |;:.._| O/ BILL / |'''''/ | \:# ###| | `-...-' /oO o / '''''/_...--'| \# 1. Pay with Cash ###| | o/O____O/ /\ |__...--' \ 2. Pay with Check ###| |_________________________/ \_______________\ 3. Pay with Credit | | | | card. |"); Console.WriteLine($"| Your total is { $"{String.Format("{0:C}", OrderOptions.GetTotalCost(order, OrderOptions.taxPercentageDecimal))}",-10} | | 4. Never mind. Go | "); Console.WriteLine("| How are you paying? | | back. |\n" + "|......................................|.|...........................| \n"); Console.Write("Type a number to make a selection: "); int checkoutUserInput = Convert.ToInt32(Validation.NumberVal(Console.ReadLine())); switch (checkoutUserInput) { case 1: Console.Clear(); OrderOptions.ListCurrentOrderDetails(order, "Your Order"); Checkout.Cash(order); Console.WriteLine("\nPress enter to continue.\n"); string z = Console.ReadLine(); return(false); case 2: Console.Clear(); OrderOptions.ListCurrentOrderDetails(order, "Your Order"); Checkout.Check(order); Console.WriteLine("\nPress enter to continue.\n"); string y = Console.ReadLine(); return(false); case 3: Console.Clear(); OrderOptions.ListCurrentOrderDetails(order, "Your Order"); Checkout.CreditCard(order); Console.WriteLine("\nPress enter to continue.\n"); string x = Console.ReadLine(); return(false); case 4: Console.Clear(); return(true); default: Console.WriteLine("Not an option. Please try again.."); break; } } }