public static void Main() { Console.WriteLine(""); Console.WriteLine("Hello there! Welcome to Joe's bakery. We have the following specials: "); Console.WriteLine(""); Console.WriteLine("1. Bread is 5 Dollars per Loaf. Buy 2 get 1 free!"); Console.WriteLine("2. Pastries are 2 Dollars each, or 3 for 5 Dollars!"); Console.WriteLine(""); Console.WriteLine("Enter the number of bread loafs you'd like to purchase: "); int breadLoafs = int.Parse(Console.ReadLine()); BreadOrder newBreadOrder = new BreadOrder(breadLoafs); Console.WriteLine("Enter the number of pastries you'd like to purchase: "); int pastries = int.Parse(Console.ReadLine()); PastryOrder newPastryOrder = new PastryOrder(pastries); Console.WriteLine(""); Console.WriteLine("The cost of your bread order is: "); Console.WriteLine(newBreadOrder.OrderCost() + " Dollars"); Console.WriteLine("The cost of your pastry order is: "); Console.WriteLine(newPastryOrder.OrderCost() + " Dollars"); OrderCalculator newOrderCalculator = new OrderCalculator(); Console.WriteLine(""); Console.WriteLine("The total cost of your order is: "); Console.WriteLine(newOrderCalculator.TotalCost(newBreadOrder.OrderCost(), newPastryOrder.OrderCost()) + " Dollars"); }
public static void Start() { Console.WriteLine("How many loaves of Bread would you like?"); BreadOrder newBreadOrder = new BreadOrder(int.Parse(Console.ReadLine())); if (newBreadOrder.IsOnlyPositiveNumberCharacters()) { Console.WriteLine("Here is your bread order total: $" + (newBreadOrder.GetBreadTotal())); } else { Console.WriteLine("Please enter a positive number"); Start(); } Console.WriteLine("How many pastries would you like?"); PastryOrder newPastryOrder = new PastryOrder(int.Parse(Console.ReadLine())); if (newPastryOrder.IsOnlyPositiveNumberCharacters2()) { Console.WriteLine("Here is your pastry order total: $" + (newPastryOrder.GetPastryTotal())); } else { Console.WriteLine("Please enter a positive number"); Start(); } Console.WriteLine("Here is your grand total: $" + (newBreadOrder.GetBreadTotal() + newPastryOrder.GetPastryTotal())); }
public static void Main() { Console.WriteLine("Welcome to Pierres Bakery."); Console.WriteLine("We offer Pastrys and Bread!"); Console.WriteLine("Here are our deals currently:"); Console.WriteLine("Bread - Buy 2, get 1 free. A single loaf costs $5."); Console.WriteLine("Pastry's - Buy 1 for $2 or 3 for $5."); Console.WriteLine("**Special Today Only** Pastry's - Buy 5 for $7"); Console.WriteLine("--------------------------------------------------"); Console.WriteLine("How many Pastry's would you like?"); int pastryWanted = int.Parse(Console.ReadLine()); Console.WriteLine("How many loaves of Bread would you like?"); int breadWanted = int.Parse(Console.ReadLine()); PastryOrder pastry = new PastryOrder(); BreadOrder bread = new BreadOrder(); pastry.PastryCheckout(pastryWanted); bread.BreadCheckout(breadWanted); Console.WriteLine("Pastry Received: " + pastry.PastryAmount); Console.WriteLine("Pastry Price: " + pastry.PastryPrice + "$"); Console.WriteLine("Bread Received: " + bread.BreadAmount); Console.WriteLine("Bread Price: " + bread.BreadPrice + "$"); int total = bread.BreadPrice + pastry.PastryPrice; Console.WriteLine("Your total today will be: " + total + "$"); }
public void Pastry_InstantiateObject_Int() { int pastryAmount = 0; PastryOrder newPastry = new PastryOrder(pastryAmount); int result = newPastry.PastryAmount; Assert.AreEqual(pastryAmount, result); }
public void PastryOrder_CreateInstanceOfPastryOrder_PastryOrder() { int numberOfPastries = 4; PastryOrder newPastryOrder = new PastryOrder(numberOfPastries); Assert.AreEqual(typeof(PastryOrder), newPastryOrder.GetType()); }
public void Pastry_ReturnInt_Int6() { int pastryAmount = 6; int price = 10; PastryOrder newPastry = new PastryOrder(pastryAmount); int result = PastryOrder.PriceCalc(pastryAmount); Assert.AreEqual(price, result); }
public void Pastry_LessThan3ReturnsAmountPrice_Int() { int amount = 2; PastryOrder newBakery = new PastryOrder(); newBakery.PastryCheckout(amount); int pastry = newBakery.PastryPrice; Assert.AreEqual(4, pastry); }
public void Pastry_ReturnsPastryAmount_Int() { int amount = 2; PastryOrder newBakery = new PastryOrder(); newBakery.PastryCheckout(amount); int pastry = newBakery.PastryAmount; Assert.AreEqual(2, pastry); }
public void Pastry_EvenReturnsAmountPrice_Int() { int amount = 10; PastryOrder newBakery = new PastryOrder(); newBakery.PastryCheckout(amount); int pastry = newBakery.PastryPrice; Assert.AreEqual(14, pastry); }
public void OrderCost_CalculateCostOfPastryOrderWithDiscount_int() { int numberOfPastries = 3; int intendedOrderCost = 5; PastryOrder newPastryOrder = new PastryOrder(numberOfPastries); int pastryOrderCost = newPastryOrder.OrderCost(); Assert.AreEqual(intendedOrderCost, pastryOrderCost); }
public void PastryOrder_SetCostPerPastryTo2_int() { int numberOfPastries = 4; int intendedCostPerPastry = 2; PastryOrder newPastryOrder = new PastryOrder(numberOfPastries); int costPerPastry = newPastryOrder.CostPerPastry; Assert.AreEqual(intendedCostPerPastry, costPerPastry); }
public void Pastry_MoreThan5ReturnsAmountPrice_Int() { int amount = 5; PastryOrder newBakery = new PastryOrder(); newBakery.PastryCheckout(amount); int pastry = newBakery.PastryPrice; Assert.AreEqual(7, pastry); }
public void PastryOrder_ProvideInputForNumberOfPastriesToPurchaseInPastryOrder_int() { int numberOfPastries = 4; int intendedNumberOfPastries = 4; PastryOrder newPastryOrder = new PastryOrder(numberOfPastries); numberOfPastries = newPastryOrder.NumberOfPastries; Assert.AreEqual(intendedNumberOfPastries, numberOfPastries); }
public void TotalCost_AddCostOfPastryOrderToCostOfBreadOrderToCalculateTotalCostOfOrder_int() { int intendedTotalOrderCost = 15; int numberOfPastries = 3; PastryOrder newPastryOrder = new PastryOrder(numberOfPastries); int pastryOrderCost = newPastryOrder.OrderCost(); int numberOfLoafs = 2; BreadOrder newBreadOrder = new BreadOrder(numberOfLoafs); int breadOrderCost = newBreadOrder.OrderCost(); OrderCalculator newOrderCalculator = new OrderCalculator(); int totalOrderCost = newOrderCalculator.TotalCost(breadOrderCost, pastryOrderCost); Assert.AreEqual(intendedTotalOrderCost, totalOrderCost); }
public static void Main() { Console.WriteLine("hello and welcome to Pierre's Bakery!"); Console.WriteLine("Below are some of the food items availible"); Console.WriteLine("---------------------------------------------"); Console.WriteLine("Bread ------ $5.00 ea or buy 2 or more get one free!"); Console.WriteLine("Pastry ----- $2.00 ea or 3 for $5.00"); Console.WriteLine("---------------------------------------------"); //////////////////////////////////////////////////////////////////////////// ////////////////////// ORDERING LOGIC ////////////////////////////////////// //////////////////////////////////////////////////////////////////////////// /////////////////////bread logic ////////////////////////// Console.WriteLine("how many orders of bread would you like?"); string breadResponse = Console.ReadLine(); int breadNumber = int.Parse(breadResponse); BreadOrder bread = new BreadOrder(breadNumber); int cost = bread.AddBreadPrice(breadNumber); Console.WriteLine("would you like to buy some pastries?[y] yes [n] no"); string answer = Console.ReadLine(); if (answer.ToLower() == "y") { Console.WriteLine("how many orders of pastry would you like?"); string pastryResponse = Console.ReadLine(); int pastryNumber = int.Parse(pastryResponse); PastryOrder pastry = new PastryOrder(pastryNumber); int numberResponse2 = pastry.AddPastryPrice(pastryNumber); Console.WriteLine("your order total is $" + (pastry.PastryPrice + bread.BreadPrice) + ".00"); Console.WriteLine("Thank you for coming in today, we hope to see you again soon!"); } else if (answer.ToLower() == "n") { Console.WriteLine("your order total is $" + (bread.BreadPrice) + ".00"); Console.WriteLine("Thank you for coming in today, enjoy your bread!"); } else { Console.WriteLine("something went wrong, retrying order....."); Main(); } }
public static void Main() { Console.WriteLine("Hello! Welcome to Pierres, what would you like to order? loaves are 1 for 5 dollars and buy 2 get 1 free, and pastries and 2 dollars each with a 3 for 5 deal. Enter 'b' for bread and/or 'p' for pastry!"); String Pob = Console.ReadLine().ToLower(); if (Pob == "bp" || Pob == "pb") { Console.WriteLine("How many loaves of bread would you like? Enter a number"); int Bread = int.Parse(Console.ReadLine()); Console.WriteLine("How many pastries would you like?"); int Pastry = int.Parse(Console.ReadLine()); Console.WriteLine("Thank you, your order total is below!"); PastryOrder newPastryOrder = new PastryOrder(Pastry); int PastryTotal = PastryOrder.PriceCalc(newPastryOrder.PastryAmount); BreadOrder newBreadOrder = new BreadOrder(Bread); int BreadTotal = BreadOrder.PriceCalc(newBreadOrder.BreadAmount); Console.WriteLine(BreadTotal + PastryTotal); } else if (Pob == "p") { Console.WriteLine("How many pastries would you like?"); int Pastry = int.Parse(Console.ReadLine()); Console.WriteLine("Thank you, your order total is below!"); PastryOrder newPastryOrder = new PastryOrder(Pastry); int PastryTotal = PastryOrder.PriceCalc(newPastryOrder.PastryAmount); Console.WriteLine(PastryTotal); } else if (Pob == "b") { Console.WriteLine("How many loaves of bread would you like? Enter a number"); int Bread = int.Parse(Console.ReadLine()); Console.WriteLine("Thank you, your order total is below!"); BreadOrder newBreadOrder = new BreadOrder(Bread); int BreadTotal = BreadOrder.PriceCalc(newBreadOrder.BreadAmount); Console.WriteLine(BreadTotal); } else { Console.WriteLine("We're sorry, something went wrong. Please try again with the response 'p' and/or 'b'. Thank you!"); Main(); } }
public void PastryOrder_CreateInstanceOfPastryOrder_PastryOrder() { PastryOrder newPastryOrder = new PastryOrder(2); Assert.AreEqual(typeof(PastryOrder), newPastryOrder.GetType()); }
public void GetPastryTotal_ReturnsPastryTotalToUser_4() { PastryOrder newPastryOrder = new PastryOrder(2); Assert.AreEqual(4, newPastryOrder.GetPastryTotal()); }
public void OrderCost_CalculateOrderCostsForNotAMultipleOf3NumberOfPastries_14() { PastryOrder newPastryOrder = new PastryOrder(8); Assert.AreEqual(14, newPastryOrder.OrderCost()); }
public void PastryOrder_SetCostPerPastryTo2_2() { PastryOrder newPastryOrder = new PastryOrder(2); Assert.AreEqual(2, newPastryOrder.CostPerPastry); }
public void PastryOrder_ProvideInputForNumberOfPastries_2() { PastryOrder newPastryOrder = new PastryOrder(2); Assert.AreEqual(2, newPastryOrder.NumberOfPastries); }
public static void Main() { BreadOrder newBreadOrder = new BreadOrder(1); PastryOrder newPastryOrder = new PastryOrder(1); OrderCalculator newOrderCalculator = new OrderCalculator(); }
public void IsOnlyPositiveNumberCharacters2_ChecksIfInputIsIntOfNumberChars_False() { PastryOrder newPastryOrder = new PastryOrder(-1); Assert.AreEqual(false, newPastryOrder.IsOnlyPositiveNumberCharacters2()); }
public static void Main() { // Bread Class Call List <BreadOrder> Breads = new List <BreadOrder>() { }; BreadOrder myBread = new BreadOrder(); // Bread Class Variables int countOneB = myBread.GetCountOne(); int countTwoB = myBread.GetCountTwo(); int countThreeB = myBread.GetCountThree(); // Bread Program Sequence Console.WriteLine("Here is our Esteemed Bread Selection!: " + myBread.GetBreadOne() + " is " + myBread.GetCostOne() + " Dollars, " + myBread.GetBreadTwo() + " is " + myBread.GetCostTwo() + " Dollars, " + myBread.GetBreadThree() + " is " + myBread.GetCostThree() + " Dollars. If You Buy 2 or More of Any Bread Type, you get 50% off all of them"); startB: Console.WriteLine("What Type of Bread Would You Like? To Make it Simple for you Guys, Press 1 for White Bread, Press 2 for French Bread, or Press 3 for Elven Bread, oooo"); string choice = Console.ReadLine(); if (choice == "1") { Console.WriteLine("How Many Slices of " + myBread.GetBreadOne() + " Would You Like"); countOneB = myBread.SetCountOne(int.Parse(Console.ReadLine())); } else if (choice == "2") { Console.WriteLine("How Many Slices of " + myBread.GetBreadTwo() + " Would You Like"); countTwoB = myBread.SetCountTwo(int.Parse(Console.ReadLine())); } else if (choice == "3") { Console.WriteLine("How Many Slices of " + myBread.GetBreadThree() + " Would You Like"); countThreeB = myBread.SetCountThree(int.Parse(Console.ReadLine())); } else { Console.WriteLine("We Dont Have That Bread Thanks for Checking for Errors"); } Console.WriteLine("Do You Want to Order More? Press Y for Yes, and N for No"); string yes = Console.ReadLine().ToLower(); if (yes == "y" || yes == "yes") { goto startB; } // Adds Bread Ordered to Bread List Breads.Add(myBread); // Pastry Class Call List <PastryOrder> Pastries = new List <PastryOrder>() { }; PastryOrder myPastry = new PastryOrder(); // Pastry Class Variables int countOneP = myPastry.GetCountOne(); int countTwoP = myPastry.GetCountTwo(); int countThreeP = myPastry.GetCountThree(); // Pastry Program Sequence Console.WriteLine("Here is our Exquisite Pastry Selection!: " + myPastry.GetPastryOne() + " are " + myPastry.GetCostOne() + " Dollars, " + myPastry.GetPastryTwo() + " are " + myPastry.GetCostTwo() + " Dollars, " + myPastry.GetPastryThree() + " are " + myPastry.GetCostThree() + " Dollars. If You Buy 2 or More of Any Pastry, you get 50% off all of them"); startP: Console.WriteLine("What Type of Pastry Would You Like? To Make it Simple for you Guys, Press 1 for Cherry Danish, Press 2 for Bear Claw, or Press 3 for Jedi Pastries woahhhh."); string choiceTwo = Console.ReadLine(); if (choiceTwo == "1") { Console.WriteLine("How Many Pieces of " + myPastry.GetPastryOne() + " Would You Like"); countOneP = myPastry.SetCountOne(int.Parse(Console.ReadLine())); } else if (choiceTwo == "2") { Console.WriteLine("How Many Pieces of " + myPastry.GetPastryTwo() + " Would You Like"); countTwoP = myPastry.SetCountTwo(int.Parse(Console.ReadLine())); } else if (choiceTwo == "3") { Console.WriteLine("How Many Pieces of " + myPastry.GetPastryThree() + " Would You Like"); countThreeP = myPastry.SetCountThree(int.Parse(Console.ReadLine())); } else { Console.WriteLine("We Dont Have That Pastry Thanks for Checking for Errors"); } Console.WriteLine("Do You Want to Order More? Press Y for Yes, and N for No"); string yesTwo = Console.ReadLine().ToLower(); if (yesTwo == "y" || yesTwo == "yes") { goto startP; } Pastries.Add(myPastry); int TotalCostBread = myBread.TotalPrice(); int TotalCostPastry = myPastry.TotalPrice(); int FinalCost = TotalCostBread + TotalCostPastry; Console.WriteLine("Your Order Total is " + FinalCost + " Dollars. You Spent " + TotalCostBread + " Dollars On Bread and " + TotalCostPastry + " Dollars On Pastries"); }
public void PastryOrderConstructor_ConstructAnInstanceOfPastryClass_PastryOrder() { PastryOrder newPastryOrder = new PastryOrder(1); Assert.AreEqual(typeof(PastryOrder), newPastryOrder.GetType()); }