public static void Main() { Console.WriteLine("Welcome to Pierre's Bakery"); Console.WriteLine("Each loaf of bread is $5 but we have a bread special - buy 2, get 1 free."); Console.WriteLine("Each pastry is $2 or get 3 for $5"); Console.WriteLine("Enter the number of Bread loaves"); int inputBread = int.Parse(Console.ReadLine()); Bread newBread = new Bread(inputBread); int priceBread = newBread.GetBreadPrice(); Console.WriteLine("Enter the number of Pastries"); int inputPastry = int.Parse(Console.ReadLine()); Pastry newPastry = new Pastry(inputPastry); int pricePastry = newPastry.GetPastryPrice(); Console.WriteLine("Your total is: $ " + (priceBread + pricePastry)); }
// // PASTRY ORDER public static void ShowPastryOrder(int finalPrice) { Console.WriteLine("One pastry = $2.00"); Console.WriteLine("SPECIAL OFFER: Get 3 pastries for $5.00!"); Console.WriteLine("How many pastries would you like to order?"); int numOfPastries = int.Parse(Console.ReadLine()); Pastry newPastry = new Pastry(2); int pastryPrice = newPastry.GetPastryPrice(numOfPastries); int totalPastryPrice = pastryPrice * numOfPastries; if (numOfPastries.Equals(3)) { Console.WriteLine("Thanks for your business, enjoy this discount!"); Console.WriteLine("Your total is: " + (totalPastryPrice - 1)); } else { Console.WriteLine("Your total is: $ " + totalPastryPrice); Console.WriteLine("Thanks for coming to Pretty Baked Bakery, have an awesome day!"); } }
static void Main() { Console.WriteLine("Bonjour! Wecome to Pierre's Bakery. Bread is $5 and Pastries are $2. We also offer special deals!"); Console.WriteLine("Would you like to order some delicious bread and pastries? If Yes [press 'Y']. Otherwise [press 'Enter']."); string response = Console.ReadLine(); if (response == "Y" || response == "y") { Console.WriteLine("How many loaves of bread would you like?"); string loaves = Console.ReadLine(); int loavesInt = int.Parse(loaves); Bread newBread = new Bread(loavesInt); int breadPrice = newBread.GetBreadPrice(); Console.WriteLine("The Price for your bread is: $" + breadPrice + "."); Console.WriteLine("How many pastries would you like?"); string pastries = Console.ReadLine(); int pastryInt = int.Parse(pastries); Pastry newPastry = new Pastry(pastryInt); int pastryPrice = newPastry.GetPastryPrice(); Console.WriteLine("The Price for your pastries is $" + pastryPrice + "."); Console.WriteLine("Your grand total today is $" + (breadPrice + pastryPrice) + ". Bon appetit!"); Console.WriteLine("Would you like to place another order? If Yes [press 'Y']. Otherwise [press 'Enter']."); string response2 = Console.ReadLine(); if (response2 == "Y" || response2 == "y") { Main(); } else { Console.WriteLine("Au revior!"); } } else { Main(); } }