static void Receipt(int breadAmount, int pastryAmount) { Bread bread = new Bread(); Pastry pastry = new Pastry(); int orderTotal = bread.GetBreadTotalCost(breadAmount) + pastry.GetPastryTotalCost(pastryAmount); Console.WriteLine("Your Order is as follows:"); Console.WriteLine($"You ordered {pastryAmount} Pastries"); Console.WriteLine($"You ordered {breadAmount} Loafs of Bread"); Console.Write($"Your total is: ${orderTotal} "); Console.WriteLine("Thank you for Ordering with PierresBakery"); Console.WriteLine("You may pick up your order at the other counter"); }
public static void Main() { //Welcome message Console.WriteLine("----------------------------------------------------------------------------------------------------------"); Console.Write(" ____ _ _ ____ __ _______\n / __ \\(____ _____________ ( )_____ / __ )____ _/ /_____ _______ __ / )\n / /_/ / / _ \\/ ___/ ___/ _ \\|// ___/ / __ / __ `/ //_/ _ \\/ ___/ / / / /_____ | ______\n / ____/ / __/ / / / / __/ (__ ) / /_/ / /_/ / ,< / __/ / / /_/ / ( ' ) / / __\\ _____\n/_/ /_/\\___/_/ /_/ \\___/ /____/ /_____/\\__,_/_/|_|\\___/_/ \\__, / |. '| / | \\ | / ))\n /____/ |____|/ |`-----' /_____))\n `-----' `------'\n"); Console.WriteLine("----------------------------------------------------------------------------------------------------------"); Console.WriteLine("Welcome to Pierre's Bakery!"); Console.WriteLine("Here is our menu:"); Console.WriteLine("Bread: $5 per loaf. Buy 2, Get 1 free!"); Console.WriteLine("Pastry: $2 each. Get 3 for $5!"); //Get user input for bread order Console.WriteLine("How many bread loaves would you like to order?"); //Check if users input can be converted to an int, if not prompt user to try again until there is a valid input //Valid input: int >= 0 bool breadOrderSuccess = int.TryParse(Console.ReadLine(), out int breadOrder); while ((breadOrderSuccess == false) || (breadOrder < 0)) { Console.WriteLine("That is not a valid input. Please enter the number of bread loaves you would like. Enter 0 if you do not want any bread loaves."); breadOrderSuccess = int.TryParse(Console.ReadLine(), out breadOrder); } //Get user input for pastry order Console.WriteLine("How many pastries would you like to order?"); //Check if users input can be converted to an int, if not prompt user to try again until there is a valid input //Valid input: int >= 0 bool pastryOrderSuccess = int.TryParse(Console.ReadLine(), out int pastryOrder); while (!pastryOrderSuccess || (pastryOrder < 0)) { Console.WriteLine("That is not a valid input. Please enter the number of pastries you would like. Enter 0 if you do not want any pastries."); pastryOrderSuccess = int.TryParse(Console.ReadLine(), out pastryOrder); } // Initialize new instances of Bread and Pastry classes Bread newBread = new Bread(breadOrder); Pastry newPastry = new Pastry(pastryOrder); //Calculate costs of bread and pastry orders and output total to user newBread.CalculateBreadCost(); int breadCost = newBread.Cost; newPastry.CalculatePastryCost(); int pastryCost = newPastry.Cost; Console.WriteLine("Thank you for your order! Your total is: $" + (breadCost + pastryCost)); }
public static void Main() { Console.WriteLine("------------------------------"); Console.WriteLine("Welcome to Pierre's Bakery!"); Console.WriteLine("Bread is $5 per loaf."); Console.WriteLine("Pastrys are $2 each."); Console.WriteLine("------------------------------"); Console.WriteLine("We have 2 deals:"); Console.WriteLine("Bread: Buy 2 get 1 free"); Console.WriteLine("Pastry: Buy 3 for $5"); Console.WriteLine("------------------------------"); Console.WriteLine("What would you like to do: ['order' / 'view']"); string userDesition = Console.ReadLine().ToLower(); if (userDesition == "order") { Console.WriteLine("------------------------------"); Console.WriteLine("Which would you like to order: [Bread / Pastry]"); string type = Console.ReadLine().ToLower(); if (type == "bread") { Console.WriteLine("How many loaves do you want to order?"); int numberBread = int.Parse(Console.ReadLine()); Bread userBread = new Bread(type, numberBread); Console.WriteLine("Order received"); Main(); } else if (type == "pastry") { Console.WriteLine("How many pastrys do you want to order?"); int numberPastry = int.Parse(Console.ReadLine()); Pastry userPastry = new Pastry(type, numberPastry); Console.WriteLine("Order received"); Main(); } } else if (userDesition == "view") { Console.WriteLine("Your order of bread is $" + Bread.BreadTotalPrice()); Console.WriteLine("Your order of pastrys is $" + Pastry.PastryTotalPrice()); } }
public static void Main() { Bread hearty = new Bread(5, 0, 0); Pastry tasty = new Pastry(2, 0, 0); Console.WriteLine("Hello, world! Welcome to Pierre's Bakery! Are you interested in buying some of our hearty loaves of bread, or any of our tasty pastries today? (Yes/No)"); string userResponse = Console.ReadLine().ToLower(); if (userResponse == "no") { Console.WriteLine("--------------------------"); Console.WriteLine("Thank you for stopping by Pierre's Bakery!"); Console.WriteLine("We hope to see you back soon. Have a nice Day!"); } else { Console.WriteLine("-------------------------------------"); Console.WriteLine("Wonderful! Here are today's specials:"); Console.WriteLine("-------------------------------------"); Console.WriteLine("Bread: Buy 1 for $5, or buy 2 hearty loaves, and you get 1 for free!"); Console.WriteLine("Pastry: Buy 1 tasty pastry for $2, or 3 for $5!"); Console.WriteLine("-------------------------------------"); Console.WriteLine("How many loaves of hearty bread would you like?"); hearty.Amount = int.Parse(Console.ReadLine()); Console.WriteLine("How many tasty pastries would you like?"); tasty.Amount = int.Parse(Console.ReadLine()); tasty.pastryBag(); hearty.breadBag(); Console.WriteLine("-------------------------------------"); Console.WriteLine("Your order is ready! You have received:"); Console.WriteLine(hearty.Amount + " hearty loaves for $" + hearty.Total); Console.WriteLine(tasty.Amount + " tasty pastries for $" + tasty.Total); Console.WriteLine("Your order total is: $" + (tasty.Total + hearty.Total)); Console.WriteLine("-------------------------------------"); Console.WriteLine("Your business is greatly appreciated here at Pierre's Bakery!"); Console.WriteLine("Thank you, and have a nice day!"); } }
public static void Main() { Console.WriteLine("\n Welcome to\n\n'||''|. || ' \n || || ... .... ... .. ... .. .... ....\n ||...|' || .|...|| ||' '' ||' '' .|...|| ||. '\n || || || || || || . '|.. \n.||. .||. '|...' .||. .||. '|...' |'..|'\n\n ) '||''|. '||\n ( ) || || .... || .. .... ... .. .... ... \n ) ( ||'''|. '' .|| || .' .|...|| ||' '' '|. |\n __..---..__ || || .|' || ||'|. || || '|.|\n ,-=' / | \\ `=-. .||...|' '|..'|' .||. ||. '|...' .||. '| \n :--..___________..--; .. |\n \\.,_____________,./ ''\n\n======================================================\n\nBread costs $5.00 per loaf, and when you buy 2 you get 1 free!\n\nPastries cost $2.00, or 3 for $5.00!\n\nWould you like to place an order? [ Y / N ]\n\n======================================================\n"); string confirm = (Console.ReadLine().ToLower()); if (confirm == "y") { Console.WriteLine("\n======================================================\n\nWould you: \n\n1) Like to get your free bread loaves on top of your ordered amount\n\n\tor \n\n2) Order how many you want total and let us calculate how many should be free? \n\n\t[ 1 / 2 ]\n\n======================================================\n"); string confirmBread = (Console.ReadLine().ToLower()); Console.WriteLine("\nHow many loaves of bread would you like?\n\n======================================================\n"); int breadOrder = int.Parse(Console.ReadLine()); Console.WriteLine("\nHow many pastries would you like?\n\n======================================================\n"); int pastryOrder = int.Parse(Console.ReadLine()); Bread bread = new Bread(breadOrder, confirmBread); Pastry pastry = new Pastry(pastryOrder); Console.WriteLine(" || .\n... .. .... .... .... ... ... ... .||.\n ||' '' .|...|| .| '' .|...|| || ||' || ||\n || || || || || || | ||\n.||. '|...' '|...' '|...' .||. ||...' '|.'\n || \n ''''\n======================================================\n\nThank you for your order! Your order details are below.\n\n" + Bread.CalculateBread() + "\n" + Pastry.CalculatePastry() + "\n\nYour total order will cost: $" + ((Bread._breadPrice) + (Pastry._pastryPrice)) + ".00!\n\n======================================================\n\nWould you like to add anything to your order? [ Y / N ]\n\n======================================================\n"); string addOrder = (Console.ReadLine().ToLower()); if (addOrder == "y") { Console.WriteLine("\nAdd how many loaves of bread?\n\n======================================================\n"); int addBread = int.Parse(Console.ReadLine()); Bread._breadOrder += addBread; Console.WriteLine("\nAdd how many pastries?\n\n======================================================\n"); int addPastry = int.Parse(Console.ReadLine()); Pastry._pastryOrder += addPastry; Console.WriteLine(" || .\n... .. .... .... .... ... ... ... .||.\n ||' '' .|...|| .| '' .|...|| || ||' || ||\n || || || || || || | ||\n.||. '|...' '|...' '|...' .||. ||...' '|.'\n || \n ''''\n======================================================\n\nThank you for your order! Your final order details are below.\n\n" + Bread.CalculateBread() + "\n" + Pastry.CalculatePastry() + "\n\nYour total order will cost: $" + ((Bread._breadPrice) + (Pastry._pastryPrice)) + ".00!\n\n======================================================\n"); } else if (addOrder == "n") { Console.WriteLine("\n======================================================\n\nThank you, come back sometime soon!\n\n======================================================\n"); } } else if (confirm == "n") { Console.WriteLine("\n======================================================\n\nAll glutened out, huh? Thank you, come back sometime soon!\n\n======================================================\n"); } }
public static void Menu() { Console.WriteLine("How many loaves of bread? (type a number)"); Bread purchaseBread = new Bread(int.Parse(Console.ReadLine())); int breadAmount = purchaseBread.BreadTotal(); Console.WriteLine("--------------------------------------"); Console.WriteLine("And how many pastries? (type a number)"); Pastry purchasePastry = new Pastry(int.Parse(Console.ReadLine())); int pastryAmount = purchasePastry.PastryTotal(); int total = (breadAmount + pastryAmount); Console.WriteLine("--------------------"); Console.WriteLine("Your total is:" + " " + "$" + total); Console.WriteLine("--------------------"); System.Threading.Thread.Sleep(2000); Console.WriteLine("Thank you for stopping by! Unless you want some more? (type 'y' or 'n')"); string response = Console.ReadLine(); if (response == "y") { Menu(); } }
public static void Main() { Bread singleBread = new Bread(); singleBread.Offer = "One baguette"; singleBread.Price = 5; Bread breadDeal = new Bread(); breadDeal.Offer = "Buy two get one free baguette"; breadDeal.Price = 10; Pastry singlePastry = new Pastry(); singlePastry.Offer = "One pastry"; singlePastry.Price = 2; Pastry threePastries = new Pastry(); threePastries.Offer = "3 pastries"; threePastries.Price = 5; // prints out ascii art var arr = new[] { @" ____________________________________________ ", @"| Pierre's Bakery |", @"|____________________________________________|", @"|__|| ||___|| |_|___|___|__| ||___|| ||__|", @"||__| |__|__| |___|___|___|| |__|__| |__||", @"|__|| ||___|| |_|___|___|__| ||___|| ||__|", @"||__| |__|__| | || | | |__|__| |__||", @"|__|| ||___|| | || | | ||___|| ||__|", @"||__| |__|__| | || | | |__|__| |__||", @"|__|| ||___|| | || | | ||___|| ||__|", @"||__| |__|__| | || | | |__|__| |__||", @"|__|| ||___|| | O|| |O | ||___|| ||__|", @"||__| |__|__| | || | | |__|__| |__||", @"|__|| ||___|| | || | | ||___|| ||__|", @"||__| |__|__|__|____||_|____| |__|__| |__||", @"|LLL| |LLLLL|______________|| |LLLLL| |LLL|", @"|LLL| |LLL|______________| | |LLLLL| |LLL|", @"|LLL|__|L|______________|____|__|LLLLL|__|LLL|", }; Console.WriteLine("\n\n"); foreach (string line in arr) { Console.WriteLine(line); } Console.WriteLine("Welcome to Pierre's Bakery! I am currently having a sale! one baguette for $5(b), or buy two get one free(3b). I also have a sale on pastries(p), one for $2 or 3 for $5(3p)! What can I get you today?"); string customerChoice = Console.ReadLine(); if (customerChoice == "b") { singleBread.GetDetails(customerChoice); } if (customerChoice == "3b") { breadDeal.GetDetails(customerChoice); } if (customerChoice == "p") { singlePastry.GetDetails(customerChoice); } if (customerChoice == "3p") { threePastries.GetDetails(customerChoice); } }
public static void Main() { // Intro Console.WriteLine("-------------------------"); Console.WriteLine("Welcome to Pierre's Bakery! Would you like to order some of our fabulous bread or our award winning pastries?"); Console.WriteLine("Bread is $5 per loaf; buy 2 get 1 free! Pastries are $2 or 3 for $5!"); Console.WriteLine("Respoond with 'bread' or 'b' for bread, or 'pastry' or 'p' for pastry"); Console.WriteLine("-------------------------"); Bread bread = new Bread(0); Pastry pastry = new Pastry(0); int count = 0; // Order bread Console.WriteLine("How much bread would you like?"); if (int.TryParse(Console.ReadLine(), out count)) { bread = new Bread(count); Console.WriteLine("-------------------------"); Console.WriteLine("You chose " + count + " loaves of bread, costing $" + bread.GetCurrentCost()); Console.WriteLine("-------------------------"); } else { Console.WriteLine("ERROR: Please specify an amount (number) of bread to get."); Main(); return; } // Order pastries Console.WriteLine("How many pastries would you like?"); if (int.TryParse(Console.ReadLine(), out count)) { pastry = new Pastry(count); Console.WriteLine("-------------------------"); Console.WriteLine("You chose " + count + " pastries, costing $" + pastry.GetCurrentCost()); Console.WriteLine("-------------------------"); } else { Console.WriteLine("ERROR: Please specify an amount (number) of bread to get."); Main(); return; } // Order summary Console.WriteLine("Your order:"); if (bread.Amount > 0) { Console.WriteLine("Bread x" + bread.Amount + " for $" + bread.Cost); } if (pastry.Amount > 0) { Console.WriteLine("Pastry x" + pastry.Amount + " for $" + pastry.Cost); } Console.WriteLine("Total: $" + (bread.Cost + pastry.Cost)); // Confirm order Console.WriteLine("-------------------------"); Console.WriteLine("Would you like to confirm this order?"); Console.WriteLine("Type 'yes' or 'y' to confirm. Anything else to reset it."); string confirmation = Console.ReadLine().ToLower(); if (confirmation == "yes" || confirmation == "y") { int randYears = new Random().Next(10, 999); Console.WriteLine("-------------------------"); Console.WriteLine("Thank you for your order! It will be delivered fresh to your door in just under " + randYears + " years!"); } // Reset order else { Console.WriteLine("-------------------------"); Console.WriteLine("Your order has been reset."); Main(); } }
public static void Main() { Console.WriteLine("Hello! Welcome to Pierre's Bakery. Would you like to order something?"); Console.Write("(Write 'Yes' if you'd like to order / Write 'No' if you're just looking ) : "); string customerResponse = Console.ReadLine().ToUpper(); Console.WriteLine("------------------"); if (customerResponse == "YES") { //BREAD ORDER Console.WriteLine("The cost of bread is $5 per loaf. There's a buy 2, get 1 free special."); Console.WriteLine("If you don't want any bread, please enter 0."); Console.Write("How many loaves of bread would you like today? (Please enter a whole number) : "); string stringBreadRequest = Console.ReadLine(); int breadRequest = int.Parse(stringBreadRequest); Bread breadOrder = new Bread(breadRequest); Console.WriteLine("You've requested " + breadRequest + " loaves of bread. With today's special, that means you'll receive " + breadOrder.ExtraLoaves + " extra loaf/loaves of bread."); Console.WriteLine("------------------"); //PASTRY ORDER Console.WriteLine("Pastries are 1 for $2 or 3 for $5"); Console.WriteLine("If you don't want pastries, please enter 0."); Console.Write("How many pastries would you like today? (Please enter a whole number) : "); string stringPastryRequest = Console.ReadLine(); int pastryRequest = int.Parse(stringPastryRequest); Pastry pastryOrder = new Pastry(pastryRequest); Console.WriteLine("You've requested " + pastryRequest + " pastries."); Console.WriteLine("------------------"); if ((breadOrder.NumOfLoaves == 0) && (pastryOrder.NumOfPastries == 0)) { Console.WriteLine("Hmmm. Sounds like you don't really want to order anything today. That's okay! Have a look around if you like and let me know if you change your mind."); } else { //ORDER TOTAL Console.WriteLine("Your total today will be $" + breadOrder.CalculateOrderCost(breadOrder.TotalCostForLoaves, pastryOrder.TotalCostForPastries) + ".00"); Console.Write("Would you like a copy of your receipt? (Yes / No) : "); string wantReceipt = Console.ReadLine().ToUpper(); if (wantReceipt == "YES") { Console.WriteLine("Here's a copy of your receipt : "); Console.WriteLine("------------------"); Console.WriteLine(breadOrder.NumOfLoaves + " loaf/loaves of bread, for a total of " + breadOrder.TotalBreadLoaves + " loaf/loaves with our buy 2 get 1 free special : $" + breadOrder.TotalCostForLoaves + ".00"); Console.WriteLine(pastryOrder.NumOfPastries + " pastries : $" + pastryOrder.TotalCostForPastries + ".00"); Console.WriteLine("Today's Total : " + breadOrder.CalculateOrderCost(breadOrder.TotalCostForLoaves, pastryOrder.TotalCostForPastries) + ".00"); Console.WriteLine("Thank you for your business and have a nice day!"); } else { Console.WriteLine("Have a nice day, then. Thank you for your business!"); } } } else { Console.WriteLine("That's just fine! Have a look and enjoy the smells. Thanks for stopping by!"); } }
public static void AddItemsMenu(Order inputOrder) { List <string> breadTypes = Bread.GetBreadTypes(); List <decimal> breadPrices = Bread.GetBreadPrices(); List <string> pastryTypes = Pastry.GetPastryTypes(); List <decimal> pastryPrices = Pastry.GetPastryPrices(); string selectionType; Console.WriteLine(""); Console.WriteLine(""); Console.WriteLine("Enter 1 to add breads"); Console.WriteLine("Enter 2 to add pastries"); BreadOrPastry(); void BreadOrPastry() { string userInput = Console.ReadLine(); if (userInput == "1") { AddItemsBreadType(); } else if (userInput == "2") { AddItemsPastryType(); } else { Console.WriteLine("Invalid entry. Please try again"); BreadOrPastry(); } } void AddItemsBreadType() { Console.WriteLine(""); Console.WriteLine(""); for (int i = 0; i < breadTypes.Count; i++) { Console.WriteLine($"Enter {i} for {breadTypes[i]} bread, ${breadPrices[i].ToString("0.00")} per loaf"); } string userInput = Console.ReadLine(); int userNumber; if (int.TryParse(userInput, out userNumber) && userNumber >= 0 && userNumber < breadTypes.Count) { selectionType = breadTypes[userNumber]; AddItemsBreadNumber(); } else { Console.WriteLine("Invalid entry. Please try again"); AddItemsBreadType(); } } void AddItemsPastryType() { Console.WriteLine(""); Console.WriteLine(""); for (int i = 0; i < pastryTypes.Count; i++) { Console.WriteLine($"Enter {i} for {pastryTypes[i]} pastries, ${pastryPrices[i].ToString("0.00")} per pastry"); } string userInput = Console.ReadLine(); int userNumber; if (int.TryParse(userInput, out userNumber) && userNumber >= 0 && userNumber < breadTypes.Count) { selectionType = pastryTypes[userNumber]; AddItemsPastryNumber(); } else { Console.WriteLine("Invalid entry. Please try again"); AddItemsPastryType(); } } void AddItemsBreadNumber() { Console.WriteLine(""); Console.WriteLine(""); Console.WriteLine("How many would you like?"); string userInput = Console.ReadLine(); int userNumber; if (int.TryParse(userInput, out userNumber) && userNumber > 0 && userNumber < 100) { Bread newBread = new Bread(selectionType); inputOrder.AddBread(newBread, userNumber); Console.WriteLine($"Added x{userNumber} {selectionType} bread to cart"); MainMenu(inputOrder); } else { Console.WriteLine("Invalid entry. Please try again"); AddItemsBreadNumber(); } } void AddItemsPastryNumber() { Console.WriteLine(""); Console.WriteLine(""); Console.WriteLine("How many would you like?"); string userInput = Console.ReadLine(); int userNumber; if (int.TryParse(userInput, out userNumber) && userNumber > 0 && userNumber < 100) { Pastry newPastry = new Pastry(selectionType); inputOrder.AddPastry(newPastry, userNumber); Console.WriteLine($"Added x{userNumber} {selectionType} pastry to cart"); MainMenu(inputOrder); } else { Console.WriteLine("Invalid entry. Please try again"); AddItemsPastryNumber(); } } }
public static void Main() { Bread NewBread = new Bread("Rustic Loaf"); Pastry NewPastry = new Pastry("House Scone"); Console.WriteLine(""); Console.WriteLine("______ _ _ ______ _ "); Console.WriteLine("| ___ (_) ( ) | ___ \\ | | "); Console.WriteLine("| |_/ /_ ___ _ __ _ __ ___|/ ___ | |_/ / __ _| | _____ _ __ _ _ "); Console.WriteLine("| __/| |/ _ \\ '__| '__/ _ \\ / __| | ___ \\/ _` | |/ / _ \\ '__| | | |"); Console.WriteLine("| | | | __/ | | | | __/ \\__ \\ | |_/ / (_| | < __/ | | |_| |"); Console.WriteLine("\\_| |_|\\___|_| |_| \\___| |___/ \\____/ \\__,_|_|\\_\\___|_| \\__, |"); Console.WriteLine(" __/ |"); Console.WriteLine(" |___/ "); Console.WriteLine("-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-"); Console.WriteLine(""); Console.WriteLine("WELCOME TO PIERRE'S BAKERY! "); Console.WriteLine("The BEST place for local breads & pastries. "); Console.WriteLine("Follow the instructions below to begin."); Console.WriteLine(""); Console.WriteLine("-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-"); Console.WriteLine(""); Console.WriteLine("Type '1' for Bread & '2' for Pastries "); int caseSwitch = 0; caseSwitch = int.Parse(Console.ReadLine()); for (int CaseSwitch = 0; CaseSwitch < 4;) { CaseSwitch = caseSwitch; switch (caseSwitch) { case 1: Console.WriteLine(""); Console.WriteLine("(You've selected Bread!)"); Console.WriteLine("-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-"); Console.WriteLine(""); Console.WriteLine("We have many types of bread but due to the "); Console.WriteLine("pandemic and increased demand we are only "); Console.WriteLine("offering our rustic loaf. "); Console.WriteLine(""); Console.WriteLine("They are $5/each and you get the 3rd loaf free "); Console.WriteLine(""); Console.WriteLine("-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-"); Console.WriteLine(""); Console.WriteLine("How many Rustic Loaves would you like? "); NewBread.AddBread(int.Parse(Console.ReadLine())); Console.WriteLine("-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-"); Console.WriteLine(""); Console.WriteLine("Type '2' to order Pastries "); Console.WriteLine("or type '3' to checkout "); caseSwitch = int.Parse(Console.ReadLine()); break; case 2: Console.WriteLine(""); Console.WriteLine("(You've selected Pastries!)"); Console.WriteLine("-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-"); Console.WriteLine(""); Console.WriteLine("We offer many types of pastries but due to the "); Console.WriteLine("pandemic and increased demand we are only "); Console.WriteLine("offering our house scone. "); Console.WriteLine(""); Console.WriteLine("They are $2/each and you get the 3rd half price "); Console.WriteLine("-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-"); Console.WriteLine(""); Console.WriteLine("How many House Scones would you like? "); NewPastry.AddPastry(int.Parse(Console.ReadLine())); Console.WriteLine(""); Console.WriteLine("-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-"); Console.WriteLine(""); Console.WriteLine("Type '1' to order Bread "); Console.WriteLine("or type '3' to checkout "); caseSwitch = int.Parse(Console.ReadLine()); break; case 3: NewBread.BreadSubtotal(); NewPastry.PastrySubtotal(); if (NewBread.Quantity > 0 && NewPastry.Quantity > 0) { Console.WriteLine(""); Console.WriteLine("-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-"); Console.WriteLine(""); Console.WriteLine("We've calculated your order total. "); Console.WriteLine("Below is a break down of your order "); Console.WriteLine(""); Console.WriteLine("-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-"); Console.WriteLine(""); Console.WriteLine("Order Summary"); Console.WriteLine("============="); Console.WriteLine("Rustic Loaves"); Console.WriteLine("($5/each & get every 3rd free)"); Console.WriteLine("Price for " + NewBread.Quantity + ": $" + NewBread.BreadsSubtotal + ".00"); Console.WriteLine(""); Console.WriteLine("House Scones"); Console.WriteLine("($2/each & get every 3rd half price)"); Console.WriteLine("Price for " + NewPastry.Quantity + ": $" + NewPastry.PastriesSubtotal + ".00"); Console.WriteLine("============="); Console.WriteLine("Order Total"); Console.WriteLine("$" + NewBread.BreadsSubtotal + NewPastry.PastriesSubtotal + ".00"); Console.WriteLine("-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-"); Console.WriteLine(""); Console.WriteLine("Thank you for your order. You may close the page now. "); caseSwitch = 4; } else if (NewBread.Quantity > 0) { Console.WriteLine(""); Console.WriteLine("-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-"); Console.WriteLine(""); Console.WriteLine("We've calculated your order total. "); Console.WriteLine("Below is a break down of your order "); Console.WriteLine(""); Console.WriteLine("-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-"); Console.WriteLine(""); Console.WriteLine("Order Summary"); Console.WriteLine("============="); Console.WriteLine("Rustic Loaves"); Console.WriteLine("($5/each & get every 3rd free)"); Console.WriteLine("Price for " + NewBread.Quantity + ": $" + NewBread.BreadsSubtotal + ".00"); Console.WriteLine("============="); Console.WriteLine("Order Total"); Console.WriteLine("$" + NewBread.BreadsSubtotal + ".00"); Console.WriteLine("-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-"); Console.WriteLine(""); Console.WriteLine("Thank you for your order. You may close the page now. "); caseSwitch = 4; } else if (NewPastry.Quantity > 0) { Console.WriteLine(""); Console.WriteLine("-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-"); Console.WriteLine(""); Console.WriteLine("We've calculated your order total. "); Console.WriteLine("Below is a break down of your order "); Console.WriteLine(""); Console.WriteLine("-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-"); Console.WriteLine(""); Console.WriteLine("Order Summary"); Console.WriteLine("============="); Console.WriteLine("House Scones"); Console.WriteLine("($2/each & get every 3rd half price)"); Console.WriteLine("Price for " + NewPastry.Quantity + ": $" + NewPastry.PastriesSubtotal + ".00"); Console.WriteLine("============="); Console.WriteLine("Order Total"); Console.WriteLine("$" + NewPastry.PastriesSubtotal + ".00"); Console.WriteLine("-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-"); Console.WriteLine(""); Console.WriteLine("Thank you for your order. You may close the page now. "); caseSwitch = 4; } else { Console.WriteLine("Your order is empty "); Console.WriteLine("'1' for Bread"); Console.WriteLine("'2' for Pastries"); Console.WriteLine("'4' to exit "); caseSwitch = int.Parse(Console.ReadLine()); } break; } } }
public static void Main() { Console.WriteLine(" //============================================================================\\"); Console.WriteLine("||-----------------------------------------------------------------------------||"); Console.WriteLine("||--PPPPPPP---IIIIIIII--EEEEEEEE--RRRRRRR---RRRRRRR---EEEEEEEE--999---SSSSSS---||"); Console.WriteLine("||--PP----PP-----II-----EE--------RR----RR--RR----RR--EE--------99---SS----SS--||"); Console.WriteLine("||--PP----PP-----II-----EE--------RR----RR--RR----RR--EE--------9----SS--------||"); Console.WriteLine("||--PPPPPPP------II-----EEEEE-----RRRRRRR---RRRRRRR---EEEEE-----------SSSSSS---||"); Console.WriteLine("||--PP-----------II-----EE--------RR-RR-----RR-RR-----EE-------------------SS--||"); Console.WriteLine("||--PP-----------II-----EE--------RR--RR----RR--RR----EE-------------SS----SS--||"); Console.WriteLine("||--PP--------IIIIIIII--EEEEEEEE--RR---RR---RR---RR---EEEEEEEE--------SSSSSS---||"); Console.WriteLine("||-----------------------------------------------------------------------------||"); Console.WriteLine("||---------BBBBBBB-----AAAA----KK----KK--EEEEEEEE--RRRRRRR---YY----YY----------||"); Console.WriteLine("||---------BB----BB---AA--AA---KK---KK---EE--------RR----RR---YY--YY-----------||"); Console.WriteLine("||---------BB----BB--AA----AA--KK-KK-----EE--------RR----RR----YYYY------------||"); Console.WriteLine("||---------BBBBBB----AAAAAAAA--KKK-------EEEEE-----RRRRRRR------YY-------------||"); Console.WriteLine("||---------BB----BB--AA----AA--KK-KK-----EE--------RR-RR--------YY-------------||"); Console.WriteLine("||---------BB----BB--AA----AA--KK---KK---EE--------RR--RR-------YY-------------||"); Console.WriteLine("||---------BBBBBBB---AA----AA--KK----KK--EEEEEEEE--RR---RR------YY-------------||"); Console.WriteLine("||-----------------------------------------------------------------------------||"); Console.WriteLine(" \\============================================================================//"); Console.WriteLine(""); Console.WriteLine("=+=+=+=+= Welcome to Pierre's Bakery! =+=+=+=+=+="); Console.WriteLine(""); Console.WriteLine(" //+====================================+\\"); Console.WriteLine("||+---------------- MENU ---------------+||"); Console.WriteLine("||+--Bread $5.00 ea---------------------+||"); Console.WriteLine("||+--Bread Special: Buy 2 get 1 Free----+||"); Console.WriteLine("||+-------------------------------------+||"); Console.WriteLine("||+--Pastry $2.00 ea--------------------+||"); Console.WriteLine("||+--Pastry Special: Buy 3 for $5.00----+||"); Console.WriteLine(" \\+====================================+//"); Console.WriteLine(""); Bread bread = new Bread("loaf", 0, 0); Pastry pastry = new Pastry("pastry", 0, 0); for (int i = 0; i < 1;) { if (bread.Number == 0 && pastry.Number == 0) { Console.WriteLine("-------------------------"); Console.WriteLine("Your basket has nothing in it."); Console.WriteLine("-------------------------"); } else if (bread.Number > 0 || pastry.Number > 0) { Console.WriteLine("-------------------------"); Console.WriteLine("Your basket has: "); Console.WriteLine("-----------"); if (bread.Number > 0) { Console.WriteLine("{0} {1} of bread", bread.Number, bread.Name); } if (pastry.Number > 0) { Console.WriteLine("{0} {1} ", pastry.Number, pastry.Name); } Console.WriteLine("-------------------------"); } Console.WriteLine("What would you like to order? (Bread, Pastry, Receipt, or Exit)"); string type = Console.ReadLine().ToLower(); Console.WriteLine("-------------------------"); if (type == "bread") { if (bread.Number < 0) { Console.WriteLine("How many more loaves would you like? (if you want less use a negative number)"); } else { Console.WriteLine("How many loaves would you like?"); } string userB = Console.ReadLine(); bread.Number += int.Parse(userB); bread.Cost = Bread.BreadCost(bread.Number); bread.Name = Bread.BreadName(bread.Number); } else if (type == "pastry") { if (pastry.Number < 0) { Console.WriteLine("How many more pastries would you like? (if you want less use a negative number)"); } else { Console.WriteLine("How many pastries would you like?"); } string userP = Console.ReadLine(); pastry.Number += int.Parse(userP); pastry.Cost = Pastry.PastryCost(pastry.Number); pastry.Name = Pastry.PastryName(pastry.Number); } else if (type == "receipt") { int total = bread.Cost + pastry.Cost; decimal twt = Convert.ToDecimal(total * 1.1); Console.WriteLine("-------------------------"); Console.WriteLine("-------------------------"); Console.WriteLine("Your Total with tax is: ${0:f2}", twt); Console.WriteLine("-------------------------"); Console.WriteLine("You purchased:"); if (bread.Number > 0) { Console.WriteLine("{0} {1} of bread", bread.Number, bread.Name); } if (pastry.Number > 0) { Console.WriteLine("{0} {1}", pastry.Number, pastry.Name); } Console.WriteLine("-------------------------"); Console.WriteLine("Thank you for your order, We hope to see you again soon!"); i++; } else if (type == "exit") { Console.WriteLine("Thank you, Come again!"); i++; } else { Console.WriteLine("Input not valid, please try again."); } } }
public static void Main() { Console.Title = "ASCII Art"; string title = @" Welcome to _ __ _________ _ __ _ __ ______ __, _ __ _, __ ,______ _ __ __ _ ( / )( /( / ( / )( / )( / o ( ( / ) / | ( /,/( / ( / )( / / /--' / /-- /--< /--< /--' `. /--< /--| /< /-- /--< (__/ / _/_ (/____// \_/ \_(/____/(___) /___/_/ |_/ \_(/____// \_ _/_ // (/ Please press 'enter' once to start shopping."; Console.WriteLine(title); Console.Read(); Console.WriteLine("-=-=-=-=-=-=-=-=-=-=-=-=-"); Console.WriteLine("Today we have our world famous baked goods. We recommend our bread and our pastries!"); Console.WriteLine("We have baguettes for $5 and pastries for $2."); Console.WriteLine("-=-=-=-=-=-=-=-=-=-=-=-=-"); Console.WriteLine("But if you're looking for a deal:"); Console.WriteLine("We have buy two, get one on baguettes..."); Console.WriteLine("And three pastries for 5!"); Console.WriteLine("-=-=-=-=-=-=-=-=-=-=-=-=-"); Console.WriteLine("How many baguettes would you like?"); int userBread = int.Parse(Console.ReadLine()); Console.WriteLine("How many pastries would you like?"); int userPastry = int.Parse(Console.ReadLine()); Bread breadCalc = new Bread(5, userBread); Pastry pastryCalc = new Pastry(2, userPastry); int breadTotal = breadCalc.BreadOrder(); int pastryTotal = pastryCalc.PastryOrder(); Console.WriteLine("-=-=-=-=-=-=-=-=-=-=-=-=-"); Console.WriteLine(" "); Console.WriteLine("Your baguettes will cost: $" + breadTotal); Console.WriteLine("Your pastries will cost: $" + pastryTotal); Console.WriteLine(" "); Console.WriteLine("-=-=-=-=-=-=-=-=-=-=-=-=-"); Console.WriteLine(" "); Console.WriteLine("Your grand total is $" + (breadTotal + pastryTotal)); Console.WriteLine(" "); Console.WriteLine("-=-=-=-=-=-=-=-=-=-=-=-=-"); Console.WriteLine(" "); Console.WriteLine("Thank you for order."); Console.WriteLine("We will have those bagged and ready for you in just a moment."); Console.WriteLine("Please come again soon!"); Console.Title = "ASCII Art"; string goodbye = @" _ __ ___ _ __ _, ____ __ _ _, ,___ ______ ( / ) / ()( / ) ( | // ()( / / / | / /( / / /--< / / / / | // / (__/ /--| / __ /-- / /___/(___/ / (_ |/(___/ _/__/ |_(___/ (/____/' // o (/ "; Console.WriteLine(goodbye); }
public static void Main() { try { int breadCount; int pastryCount; int pastryUnitCost; Console.WriteLine("################# Welcome to Pierre's Bakery #################"); Console.WriteLine("# Menu #"); Console.WriteLine("# 1. Bread : Buy 2, get 1 free. A single loaf costs $5 #"); Console.WriteLine("# 2. Pastry : Buy 1 for $2 or 3 for $5 #"); Console.WriteLine("##############################################################"); Console.WriteLine("Enter Bread Qty: "); bool parseSuccessBread = int.TryParse(Console.ReadLine(), out breadCount); Console.WriteLine("Enter Pastry Qty: "); bool parseSuccessPastry = int.TryParse(Console.ReadLine(), out pastryCount); while ((!parseSuccessBread) || (breadCount < 0) || (!parseSuccessPastry) || (pastryCount < 0) || (breadCount > 25) || (pastryCount > 25)) //ensure qty entered is int and is 0 or greater & less than 25 { Console.WriteLine("INVALID. Enter a valid Quantity else enter Q to Exit or hit ENTER to restart"); if (Console.ReadLine() == "Q") { System.Environment.Exit(1); } else { Main(); } } Bread bread = new Bread(breadCount); Pastry pastry = new Pastry(pastryCount); Console.WriteLine($"{"\n"}THANK YOU for your order!!!! See receipt below ....{"\n"}{"\n"}"); Console.WriteLine("###################### Pierre's Bakery #######################"); Console.WriteLine($"Invoice # {Pastry.UnixTimeNow()}"); Console.WriteLine($"Date: {DateTime.Now.ToString("M/d/yyyy")}"); Console.WriteLine($"Time: {DateTime.Now.ToString("h:mm:ss tt")}{"\n"}"); Console.WriteLine("=============================================================="); Console.WriteLine($"ITEM{"\t"}QTY{"\t"}DESC{"\t"}{"\t"}{"\t"}{"\t"}RATE{"\t"}AMOUNT"); Console.WriteLine($"Bread{"\t"}{breadCount}{"\t"}Total Qty is {bread.FindTotalQuantity()}{"\t"}{"\t"}{"\t"}${bread.BreadUnitCost}{"\t"}${bread.FindTotalCost()}"); if (pastryCount > 2) { pastryUnitCost = pastry.PastryCostForThree; } else { pastryUnitCost = pastry.PastryUnitCost; } Console.WriteLine($"Pastry{"\t"}{pastryCount}{"\t"}Buy 1 for $2 or 3 for $5{"\t"}${pastryUnitCost}{"\t"}${pastry.FindTotalCost()}"); Console.WriteLine("=============================================================="); Console.WriteLine($"TOTAL{"\t"}{"\t"}{"\t"}{"\t"}{"\t"}{"\t"}{"\t"}${bread.FindTotalCost() + pastry.FindTotalCost()}"); System.Environment.Exit(1); } catch (Exception ex) { Console.WriteLine("Message = {0}", ex.Message); Console.WriteLine("Source = {0}", ex.Source); Console.WriteLine("StackTrace = {0}", ex.StackTrace); Console.WriteLine("TargetSite = {0}", ex.TargetSite); } }
public static void Main() { Console.WriteAscii("Pierre's Bakery"); Console.WriteLine("Welcome to Pierre's Bakery! Bread is $5, buy 2 get 1 free. Pastries are $2 or 3 for $5"); Console.WriteLine("How many loaves of bread would you like?"); string breadResponse = Console.ReadLine(); int breadQuantity = int.Parse(breadResponse); Bread newBreadOrder = new Bread(breadQuantity); int breadTotal = newBreadOrder.GetTotalBread(breadQuantity); Console.WriteLine("How many pastries would you like?"); string pastryResponse = Console.ReadLine(); int pastryQuantity = int.Parse(pastryResponse); Pastry newPastryOrder = new Pastry(pastryQuantity); int pastryTotal = newPastryOrder.GetTotalPastry(pastryQuantity); Console.WriteLine("Your total is: $" + (breadTotal + pastryTotal)); Console.WriteLine("Is your order correct? Press [Y] for Yes, [N] for No"); string completeOrder = Console.ReadLine(); if (completeOrder == "y" || completeOrder == "Y") { Console.WriteLine("Thanks, have a nice day!"); Main(); } else { Console.WriteLine("Okay, which would you like to revise? Type [Bread Order] [Pastry Order] or [Nevermind] to go back to Start a New Order"); string reviseOrder = Console.ReadLine(); if (reviseOrder == "Bread Order" || reviseOrder == "bread order") { Console.WriteLine("No problem! How many loaves of bread would you like?"); breadResponse = Console.ReadLine(); breadQuantity = int.Parse(breadResponse); breadTotal = newBreadOrder.GetTotalBread(breadQuantity); Console.WriteLine("Would you also like to revise your pastry order? Press [Y] for Yes, [N] for No"); string revisePastry = Console.ReadLine(); if (revisePastry == "Y" || revisePastry == "y") { Console.WriteLine("No problem! How many pastries would you like?"); pastryResponse = Console.ReadLine(); pastryQuantity = int.Parse(pastryResponse); pastryTotal = newPastryOrder.GetTotalPastry(pastryQuantity); Console.WriteLine("Your new total is: $" + (breadTotal + pastryTotal)); Main(); } else { Console.WriteLine("Your new total is: $" + (breadTotal + pastryTotal)); Main(); } } else if (reviseOrder == "Pastry Order" || reviseOrder == "pastry order") { Console.WriteLine("No problem! How many pastries would you like?"); pastryResponse = Console.ReadLine(); pastryQuantity = int.Parse(pastryResponse); pastryTotal = newPastryOrder.GetTotalPastry(pastryQuantity); Console.WriteLine("Would you also like to revise your bread order? Press [Y] for Yes, [N] for No"); string reviseBread = Console.ReadLine(); if (reviseBread == "Y" || reviseBread == "y") { Console.WriteLine("No problem! How many loaves of bread would you like?"); breadResponse = Console.ReadLine(); breadQuantity = int.Parse(breadResponse); breadTotal = newBreadOrder.GetTotalBread(breadQuantity); Console.WriteLine("Your new total is: $" + (breadTotal + pastryTotal)); Main(); } else { Console.WriteLine("Your new total is: $" + (breadTotal + pastryTotal)); Main(); } } else { Main(); } } }
public static void Main() { Bread bread = new Bread(); Pastry pastry = new Pastry(); Console.WriteLine("Welcome to Pierres Bakery!"); Console.WriteLine("Prices: Bread $5 and Pastry $2 (Each one)"); Console.WriteLine("Would you like to buy bread? Enter Y for yes"); string breadInput = Console.ReadLine(); if (breadInput == "yes" || breadInput == "Yes" || breadInput == "y" || breadInput == "Y") { Console.WriteLine("Deal: Buy 2 bread loafs, get 1 free!"); // Console.WriteLine("Select a bread option: "); // Bread bread1 = new Bread("Garlic"); // Bread bread2 = new Bread("Italian Herbs"); // Bread bread3 = new Bread("Whole Wheat"); // List<Bread> BreadList = new List<Bread>{bread1, bread2, bread3}; // int i = 1; // foreach(Bread breadGroup in BreadList) // { // Console.WriteLine("----------------------"); // Console.WriteLine(breadGroup.Name + " (" + i + ")"); // i++; // } // Console.WriteLine("Select bread type (1-3):"); // int breadType = Console.ReadLine(); Console.WriteLine("Enter the # of bread loafs you want to buy: "); int breadNo = int.Parse(Console.ReadLine()); if (breadNo != 0) { bread.BreadInvoice(breadNo); // if(breadType==1) { // bread1.BreadInvoice(breadNo); // } // else if(breadType==2) { // bread2.BreadInvoice(breadNo); // } // else if(breadType==3) { // bread3.BreadInvoice(breadNo); // } Console.WriteLine("Bread loaf quantity: " + breadNo + " Your bread total is: " + bread.Price + "$"); } } else { Console.WriteLine("Goodbye!"); Environment.Exit(0); } Console.WriteLine("Would you like to buy pastries? Enter Y for yes"); string pastryInput = Console.ReadLine(); if (pastryInput == "yes" || pastryInput == "Yes" || pastryInput == "y" || pastryInput == "Y") { Console.WriteLine("Deal: Buy 3 pastries for $5!"); // Console.WriteLine("Select a pastry option: "); // Pastry pastry1 = new Pastry("Tiramisu", 2); // Pastry pastry2 = new Pastry("Matcha Cake", 2); // Pastry pastry3 = new Pastry("Macaron", 2); // List<Pastry> PastryList = new List<Pastry>{ pastry1, pastry2, pastry3 }; // foreach(Pastry PastryGroup in PastryList) // { // Console.WriteLine("----------------------"); // Console.WriteLine(PastryGroup.Name); // } // string pastryType = Console.ReadLine(); Console.WriteLine("Enter the # of pastries you want buy: "); int pastryNo = int.Parse(Console.ReadLine()); if (pastryNo != 0) { pastry.PastryInvoice(pastryNo); // int pastryBuy= Pastry.PastryInvoice(pastryNo); // if (pastryNo == 3) // { // Console.WriteLine("You get the 3 for $5 deal!"); // } Console.WriteLine("Pastry quantity: " + pastryNo + " Your pastry total is:" + pastry.Price + "$"); } } int finalTotal = bread.Price + pastry.Price; Console.WriteLine("You entire purchase total is: " + finalTotal + "$ "); Console.WriteLine("Thank you for buying at Pierres Bakery! Come back soon!"); // Console.WriteLine("Your total is" + breadBuy + pastryBuy + "$"); }