public Menu() { int index = 1; //breads Bread bread1 = new Bread("Traditional French Baguette", 3, index); Bread bread2 = new Bread("Small French Boule", 4.5, index++); Bread bread3 = new Bread("Kalamata Olive", 6, index++); Bread bread4 = new Bread("Walnut Raisin", 6, index++); Bread bread5 = new Bread("Brioche", 7.5, index++); Bread bread6 = new Bread("Whole Wheat Multi-Grain", 6.5, index++); Pastry pastry1 = new Pastry("Butter Croissant", 3, index); Pastry pastry2 = new Pastry("Chocolate Croissant", 3.5, index++); Pastry pastry3 = new Pastry("Almond Croissant", 3.5, index++); Pastry pastry4 = new Pastry("Chocolate Almond Croissant", 4, index++); Pastry pastry5 = new Pastry("Raspberry Almond Croissant", 4, index++); Pastry pastry6 = new Pastry("Pistachio White Chocolate Almond Croissant", 5, index++); Items = new BakeryItem[] { bread1, bread2, bread3, bread4, bread5, bread6, pastry1, pastry2, pastry3, pastry4, pastry5, pastry6 }; }
public static void Main() { Console.WriteLine("Welcome to Pierre's Bakery! Our specials today are Bread: Buy 2, get 1 free. A single loaf costs $5 & Pastry: Buy 1 for $2 or 3 for $5."); string purchase = ""; while (!(purchase == "NO")) { Console.WriteLine("How many loaves of Bread would you like?)"); string stringBreadInput = Console.ReadLine(); int breadInput = int.Parse(stringBreadInput); Bread newBread = new Bread(breadInput); newBread.AddToList(); Console.WriteLine("How many pastries would you like?"); string stringPastryInput = Console.ReadLine(); int pastryInput = int.Parse(stringPastryInput); Pastry newPastry = new Pastry(pastryInput); newPastry.AddToList(); int subtotalBread = newBread.CalculateCost(); int subtotalPastry = newPastry.CalculateCost(); int grandTotal = subtotalBread + subtotalPastry; Console.WriteLine("Your grand total is: $" + grandTotal); Console.WriteLine("Would you like more bread or pastry? Yes/No"); purchase = Console.ReadLine().ToUpper(); if (purchase == "YES") { } else if (!(purchase == "NO" || purchase == "YES")) { while (!(purchase == "NO" || purchase == "YES")) { Console.WriteLine("Please answer yes or no"); purchase = (Console.ReadLine()).ToUpper(); } } } }
public static void Main() { Console.WriteLine("Welcome to Zahnen's Bakery! We sell fresh boules of sourdough ($5.00 per boule) and a rotating daily pastry ($2.00 per pastry). We're running a special on both items. For every two boules you buy, we'll throw in a third for free. For every 2 pastries you buy, we'll offer a third for half off. Enter the number of sourdough boules you'd like to buy:"); string userBreadQuant = Console.ReadLine(); int BreadQuant = int.Parse(userBreadQuant); Console.WriteLine("Wonderful. Would you like any of our daily pastries? Today we're offering pistachio pinwheels. Enter the number of pinwheels you'd like to buy:"); string userPastryQuant = Console.ReadLine(); int PastryQuant = int.Parse(userPastryQuant); Bread userBread = new Bread(5, BreadQuant); Pastry userPastry = new Pastry(2, PastryQuant); int BreadTotal = userBread.GetBreadTotal(); int PastryTotal = userPastry.GetPastryTotal(); int GrandTotal = BreadTotal + PastryTotal; Console.WriteLine("Sounds good. Your order confirmation is listed below."); Console.WriteLine("ZAHNEN'S BAKERY"); Console.WriteLine(" ------"); Console.WriteLine("Number of Boules:" + userBreadQuant); Console.WriteLine("Number of Pastries:" + userPastryQuant); Console.WriteLine("Grand Total: $" + GrandTotal + ".00."); }
public static void Main() { Console.WriteLine("Welcome to Pierre's Bakery! Press ['Y'] to see today's offerings"); string menu = Console.ReadLine(); Bread newBread = new Bread(0); Pastry newPastry = new Pastry(0); if (menu == "Y" || menu == "y") { Console.WriteLine("Whole Wheat Loaves $6"); Console.WriteLine("**Sale!** Sourdough Boules $5 or Buy 2 Get 1 Free"); Console.WriteLine("**Sale!** Sugar Cookies $2 or 3 for $5"); Console.WriteLine("How many Whole Wheat Loaves would you like to purchase? If none, please enter 0!"); string wholeWheat = Console.ReadLine(); int wholeWheatOrder = int.Parse(wholeWheat); newBread.AddOrderToList(wholeWheatOrder * 6); Console.WriteLine("That will be $" + (wholeWheatOrder * 6)); Console.WriteLine("How many Sourdough Boules would you like to purchase? If none, please enter 0!"); string userBreadInput = Console.ReadLine(); int breadOrder = int.Parse(userBreadInput); int breadTotal = newBread.TallyBreadOrder(breadOrder); newBread.AddOrderToList(breadTotal); Console.WriteLine("That will be $" + breadTotal); Console.WriteLine("How many pastries would you like to purchase? If none, please enter 0!"); string userPastryInput = Console.ReadLine(); int pastryOrder = int.Parse(userPastryInput); int pastryTotal = newPastry.TallyPastryOrder(pastryOrder); newPastry.AddOrderToList(pastryTotal); Console.WriteLine("That will be $" + pastryTotal); // Console.Write("Your order total is $" + (breadTotal + pastryTotal)); Console.WriteLine("Your total today will be $" + (newBread.TotalBreadOrder() + newPastry.TotalPastryOrder()) + ". Thankyou for shopping at Pierre's!"); } else { Main(); } }
public static void Main() { try { Console.WriteLine("Please enter the number of Loaves you'd like."); Console.WriteLine("Bread is 5 Ruppees a loaf and buy 2, get 1 free!"); string breadOrder = Console.ReadLine(); int breadOrderNumber = Int32.Parse(breadOrder); Bread loaves = new Bread(breadOrderNumber); Console.WriteLine("Please enter the number of Pastries you'd like."); Console.WriteLine("Pastries are 2 Ruppees each, or 3 for 5!"); string pastryOrder = Console.ReadLine(); int pastryOrderNumber = Int32.Parse(pastryOrder); Pastry pastries = new Pastry(pastryOrderNumber); Console.WriteLine("The Price for Bread is: " + " " + loaves.BreadPrice() + " " + "Ruppees"); Console.WriteLine("The Price for Pastries is: " + " " + pastries.PastryPrice() + " " + "Ruppees"); Order total = new Order(loaves.BreadPrice(), pastries.PastryPrice()); Console.WriteLine("The Total Price of Your Order is: " + " " + total.OrderTotal + " " + "Ruppees"); Console.WriteLine("If you would like to place another order, enter Y, all other input will end program."); string cont = Console.ReadLine(); if (cont == "Y") { Console.WriteLine("Here We Go Again!"); Main(); } else { Console.WriteLine("Thanks for Stopping By! There's Monsters Out There, Travel Safe!"); } } catch (Exception e) { Console.WriteLine(e.Message + " " + "Please Pay Attention to the Prompts. Only The Suggested Inputs are Valid"); Main(); } }
static void Main() { Console.WriteLine("≤≥≤≥≤≥≤≥≤≥≤≥≤≥≤≥≤≥≤≥≤≥≤≥≤≥≤≥≤≥≤≥≤≥≤≥≤≥≤≥≤≥≤≥≤≥≤≥≤≥≤≥≤≥≤≥"); Console.WriteLine(" Welcome to Boulangerie de Pierre! "); Console.WriteLine("≤≥≤≥≤≥≤≥≤≥≤≥≤≥≤≥≤≥≤≥≤≥≤≥≤≥≤≥≤≥≤≥≤≥≤≥≤≥≤≥≤≥≤≥≤≥≤≥≤≥≤≥≤≥≤≥"); Console.WriteLine(" We have two deals going on right now:"); Console.WriteLine(" Bread is 'Buy 2 get 1 FREE!"); Console.WriteLine(" Pastries are 'Buy 1 for $2 or 3 for $5!"); Console.WriteLine("_______________________________________________________"); Console.WriteLine(" Normal Price of Bread: $5"); Console.WriteLine(" Normal Price of Pastries: $2"); Console.WriteLine("_______________________________________________________"); Console.WriteLine(" START YOUR ORDER BELOW!"); Console.WriteLine("_______________________________________________________"); Console.WriteLine(" 1. View Order 2.Add to Order 3.See Total"); string userInput1 = Console.ReadLine(); if (userInput1 == "1") { Console.WriteLine("_______________________________________________________"); Console.WriteLine(" Here is your Itemized order so far:"); Console.WriteLine("_______________________________________________________"); List <Bread> BreadResult = Bread.GetAll(); Bread.GetAll().ForEach(i => Console.WriteLine(i.BreadDescription + " $" + i.BreadPrice)); List <Pastry> pastryResult = Pastry.GetAll(); Pastry.GetAll().ForEach(i => Console.WriteLine(i.PastryDescription + " $" + i.PastryPrice)); Console.WriteLine("_______________________________________________________"); Console.WriteLine(" Would you like to do?"); Console.WriteLine(" 1. Clear Order 2. Main Menu"); Console.WriteLine("_______________________________________________________"); string userInput2 = Console.ReadLine(); if (userInput2 == "1") { Console.WriteLine(" Your Order is Cleared"); Bread.ClearAll(); Pastry.ClearAll(); Program.Main(); } else if (userInput2 == "2") { Program.Main(); } else { Console.WriteLine("Program Terminated. Please use the command 'dotnet run' to begin... again."); } } else if (userInput1 == "2") { Console.WriteLine("_______________________________________________________"); Console.WriteLine(" What would you like to add to your order?"); Console.WriteLine("_______________________________________________________"); Console.WriteLine(" 1. Bread 2. Pastry"); Console.WriteLine("_______________________________________________________"); string userInput3 = Console.ReadLine(); if (userInput3 == "1") { Console.WriteLine("_______________________________________________________"); Console.WriteLine(" How many Bread loafs would you like to add?"); Console.WriteLine("_______________________________________________________"); int userAmount1 = int.Parse(Console.ReadLine()); Bread.GetPriceBread(userAmount1); Console.WriteLine("_______________________________________________________"); Console.WriteLine(" Bread added to order"); Console.WriteLine("_______________________________________________________"); Program.Main(); } else if (userInput3 == "2") { Console.WriteLine("_______________________________________________________"); Console.WriteLine(" How many Pastries would you like to add?"); Console.WriteLine("_______________________________________________________"); int userAmount2 = int.Parse(Console.ReadLine()); Pastry.GetPricePastry(userAmount2); Console.WriteLine("_______________________________________________________"); Console.WriteLine(" Pastries added to order"); Console.WriteLine("_______________________________________________________"); Program.Main(); } else { Console.WriteLine("Program Terminated. Please use the command 'dotnet run' to begin... again."); } } else if (userInput1 == "3") { Console.WriteLine("_______________________________________________________"); Console.WriteLine(" Here Is your Order:"); Console.WriteLine("_______________________________________________________"); int BreadTotal = 0; Bread.GetAll().ForEach(i => BreadTotal += i.BreadPrice); Console.WriteLine("Bread: $" + BreadTotal); int PastryTotal = 0; Pastry.GetAll().ForEach(i => PastryTotal += i.PastryPrice); Console.WriteLine("Pastry: $" + PastryTotal); int GrandTotal = BreadTotal + PastryTotal; Console.WriteLine("_______________________________________________________"); Console.WriteLine(" Your Order Total is: " + "$" + GrandTotal); Console.WriteLine("_______________________________________________________"); Console.WriteLine(" Press any key to go back to main Menu"); Console.WriteLine("_______________________________________________________"); Console.ReadLine(); Program.Main(); } else { Console.WriteLine("Please choose an option from the numerical list"); Console.WriteLine("Program is terminated, please use the command 'dotnet run' to start"); } }
// Amount of bread purchase is added to the BreadsOrder list public void AddBread(Bread bread) { BreadOrder.Add(bread); }
public void AddBread(int inputOrder) { BreadOrder = new Bread(inputOrder); }
public static int BreadPrice() { int total = (Bread.BreadCount() * 5) - ((Bread.BreadCount() / 3) * 5); return(total); }
public static void Main() { Console.ForegroundColor = ConsoleColor.Yellow; Console.BackgroundColor = ConsoleColor.Black; string bakeryAscii = @" .... .' `. .' .-'``-._ `. | / - - ` | / |'<o> <o> | \ (| '` |) \ -==- / `.____.' | | _ _.'`-.__.-'`._/_ .'| |`-. /\ .-'| |`. _.' \ \ `' `' / / `._ { `. | `-.____.-' | .' } /`. `./ / __ __ \ \.' .'\ / `.| | / \/ \ | |.' \ ( ( \ \ \ / / / ) ) `. \ Y| `. .' |Y / .' \ \ ||_ _ _\/_ _ _|| / / `. \|' `|/ .' _______/ _ >--------------< _ \______.##._ ((((_( )_)))) .##. | / ```` `--------------' ''''\ | | | ( Welcome to Faisal's Bakery! \ | |-' ) ) `--' ( _ _.---.__.-' `-.___.--' `------' "; Console.ForegroundColor = ConsoleColor.DarkBlue; Console.WriteLine(bakeryAscii); Console.ForegroundColor = ConsoleColor.Gray; Console.WriteLine("Please [y] to place your order, [m] to view the menu and [n] to exit"); string continueAnswer = Console.ReadLine().ToLower(); if (continueAnswer == "y") { Console.WriteLine("How many loaves of bread would you like to purchase today?"); string stringNumOfBread = Console.ReadLine(); int numOfBread = checkInput(stringNumOfBread); if (numOfBread >= 0) { Bread bread = new Bread(); bread.CalcBread(numOfBread); Console.ForegroundColor = ConsoleColor.Blue; Console.WriteLine("You have bought " + numOfBread + " loaves of bread for: $" + bread.BreadPrice); Console.ForegroundColor = ConsoleColor.Yellow; Console.WriteLine("Would you like to buy some Pastry's today? [y] or [n]"); string pastryAnswer = Console.ReadLine().ToLower(); if (pastryAnswer == "y") { Console.WriteLine("Please enter the number of pastry's you would like to buy:"); string stringNumOfPastry = Console.ReadLine(); int numOfPastry = 0; bool checkPastryInput = Int32.TryParse(stringNumOfPastry, out numOfPastry); if (checkPastryInput == true) { if (numOfPastry >= 0) { Pastry pastry = new Pastry(); pastry.CalcPastry(numOfPastry); Console.ForegroundColor = ConsoleColor.Blue; Console.WriteLine("You have bought " + numOfBread + " loaves of bread for: $" + bread.BreadPrice); Console.WriteLine("You have bought " + numOfPastry + " pastry's for $" + pastry.PastryPrice); Console.BackgroundColor = ConsoleColor.Black; Console.ForegroundColor = ConsoleColor.Green; int total = bread.BreadPrice + pastry.PastryPrice; Console.WriteLine("Your total bill is $" + total); Console.ForegroundColor = ConsoleColor.Gray; Console.WriteLine("Goodbye"); } else { ErrorNegativeNumber(); } } else { Error(); } } else if (pastryAnswer == "n") { Console.WriteLine("Thank you for coming in, your total bill is $" + bread.BreadPrice); Console.WriteLine("Goodbye"); } else { Error(); } } else if (numOfBread == -1000) { Error(); } else { ErrorNegativeNumber(); } } else if (continueAnswer == "m") { Menu(); } else if (continueAnswer == "n") { Console.WriteLine("Goodbye"); } else { Error(); } }
static void Main() { Bread newBreadOrder = new Bread(5); Pastry newPastryOrder = new Pastry(2); Order newOrder = new Order(0, 0, 0, 0); Console.WriteLine("Welcome to Fresh Out the Coven Bakery!"); Console.WriteLine("Please take a look at our menu before placing your order:"); Console.WriteLine("==========================================="); Console.WriteLine(" Breads $5 || Pastries $2 "); Console.WriteLine("-------------------------------------------"); Console.WriteLine(" French || Sweet Bun "); Console.WriteLine(" Italian || Cinnamon Bun "); Console.WriteLine(" Rye || Danish "); Console.WriteLine(" Sourdough || Croissant "); Console.WriteLine(" Brioche || Eclaire "); Console.WriteLine(" Whole Grain || Bear Claw "); Console.WriteLine(" Olive Loaf || Swiss Roll "); Console.WriteLine(" Pretzel || Panettone "); Console.WriteLine("-------------------------------------------"); Console.WriteLine(" ~DAILY DEALS~ "); Console.WriteLine(" Breads: 2 for 1 "); Console.WriteLine(" Pastries 3 for $5 "); Console.WriteLine("==========================================="); Console.WriteLine(" Please place your order here: "); Console.WriteLine("Please list the BREADS you would you like, separated by commas:"); string breads = Console.ReadLine(); Console.WriteLine("Please list the PASTRIES you would you like, separated by commas:"); string pastries = Console.ReadLine(); Console.WriteLine("Please confirm your order!"); string[] breadsArr = breads.Split(", "); string[] pastriesArr = pastries.Split(", "); int breadsTotal = breadsArr.Length; int pastriesTotal = pastriesArr.Length; int costB = newBreadOrder.Bogo(breadsTotal); int costP = newPastryOrder.PastDeal(pastriesTotal); int orderCost = costB + costP; Console.WriteLine("Your current order:"); newOrder.newBreadsOrder(breadsArr); newOrder.newPastriesOrder(pastriesArr); Console.WriteLine("The total for your BREADS is: $" + costB + ".00"); Console.WriteLine("The total for your PASTRIES is: $" + costP + ".00"); Console.WriteLine("The grand total for your order is: $" + orderCost + ".00"); Console.WriteLine("Is this correct? y/n"); string response = Console.ReadLine(); if (response == "n") { newOrder.newBreadsOrder(breadsArr); Console.WriteLine("The total for your BREADS is: $" + costB); newOrder.newPastriesOrder(pastriesArr); Console.WriteLine("The total for your PASTRIES is: $" + costP); Console.WriteLine("The grand total for your order is: $" + orderCost + ".00"); Console.WriteLine("Please confirm your order!"); Console.WriteLine("Is this correct? y/n"); response = Console.ReadLine(); } else if (response == "y") { Console.WriteLine("Would you like to submit your order? (y/n"); string confirm = Console.ReadLine(); if (confirm == "y") { Console.WriteLine("Processing order..."); Console.WriteLine("YOUR ORDER HAS BEEN PLACED!"); Console.WriteLine("+++++++order+summary+++++++"); newOrder.newBreadsOrder(breadsArr); newOrder.newPastriesOrder(pastriesArr); Console.WriteLine("PAID $" + orderCost + ".00 PAID"); } else if (confirm == "n") { Console.WriteLine("Your order has been CANCELLED"); } } }