public static void Main() { //UI Console.WriteLine("Welcome to Pierres Pastries: "); Console.WriteLine("Daily Deal: Bread: (Buy 2 get 1 FREE!) and Pastries: (Buy 1 for $2 or 3 for $5)"); Console.WriteLine("================================================================================"); Console.WriteLine("Bread Price: $5 per loaf"); Console.WriteLine("Pastry Price: $2 per Pastry"); Console.WriteLine("Please input the amount of Bread you would like: (Number form ex. 1,2,3 ect.)"); int inputBread = Convert.ToInt32(Console.ReadLine()); Console.WriteLine("Please input the amount of Pastries you would like: (Number form ex. 1,2,3 ect.)"); int inputPastry = Convert.ToInt32(Console.ReadLine()); //Bread Purchase Bread bread = new Bread(inputBread, 5); Console.WriteLine(bread.BreadItem); bread.breadAddUp(); // int remainder = inputBread / 3; // int breadTotal = (inputBread - remainder) * 5; Console.WriteLine("The bread will cost $" + bread.TotalBread); // Pastry Pastry pastry = new Pastry(inputPastry, 2); // int modulo = inputPastry % 3; // int dailyDeal = inputPastry / 3; // int pastryTotal = (2 * modulo) + (dailyDeal * 5); Console.WriteLine("The pastry will cost $ " + pastry.TotalPastry); }
public void PastryTotal_CalculatePastryTotalOfOneWithoutDiscount_Int() { int quantity = 1; Pastry newPastry = new Pastry(quantity); Assert.AreEqual(2, newPastry.PastryTotal(quantity)); }
public void Pastry_CreatesInstanceOfPastryPrice_Int() { Pastry newPastry = new Pastry(1); int result = newPastry.Price; Assert.AreEqual(2, result); }
public void PastryCost_BuyThreeforFive_3and5() { Pastry newPastry = new Pastry(3); Assert.AreEqual(3, newPastry.PastryCost()[0]); Assert.AreEqual(5, newPastry.PastryCost()[1]); }
static void Main() { Console.WriteLine("Bon jour! I am Pierre, welcome to my bakery monsieur and madame."); Thread.Sleep(1000); Console.WriteLine("We have a lovely selection of bread and pastries to choose from."); Thread.Sleep(1500); Console.WriteLine("What will you be needing today? A loaf of bread is $5. And a Pastry is $2."); Thread.Sleep(2000); Console.WriteLine("The deals are as follows:"); Thread.Sleep(1500); Console.WriteLine("If you buy two loaves of bread, you get the third one free!"); Console.WriteLine("And it's buy 3 pastries for 5$!"); Thread.Sleep(2000); Console.WriteLine("What can Pierre get for you today? How many loaves do you need?"); string stringLoaves = Console.ReadLine(); int loaves = int.Parse(stringLoaves); Console.WriteLine("Excellent. And how many pastries will you be needing?"); string stringPastries = Console.ReadLine(); int pastries = int.Parse(stringPastries); Bread breadOrder = new Bread(loaves, 5); Pastry pastryOrder = new Pastry(pastries, 2); int total = breadOrder.GetBreadPrice() + pastryOrder.GetPastryPrice(); Console.WriteLine("You are Pierre's favorite customer! You owe me $" + breadOrder.GetBreadPrice() + " for your loaves of bread, and $" + pastryOrder.GetPastryPrice() + " for your pastries. Your total comes to $" + total + " See you soon!"); }
public async Task <ActionResult <Pastry> > PostPastry([FromBody] Pastry pastry) { PastryRepository.Create(pastry); await PastryRepository.SaveChangesAsync(); return(CreatedAtAction("GetPastry", new { id = pastry.Id }, pastry)); }
public void Pastry_CalculatePastryOrderPrice_PastryPrice() { int numberOfPastries = 32; Pastry pastryOrder = new Pastry(numberOfPastries); Assert.AreEqual(54, pastryOrder.PastryPrice()); }
public void AddTestItem_ForOneItem_int() { Pastry PastryItem = new Pastry(1); int result = 2; Assert.AreEqual(result, PastryItem.AddPastryItem()); }
public void PastryPrice_CalculatesPastryPrice_Int() { Pastry newPastry = new Pastry(); newPastry.AddItems(1); Assert.AreEqual(2, newPastry.Price); }
public void AddTestItem_DiscountPastryItem_int() { Pastry PastryItem = new Pastry(3); int result = 5; Assert.AreEqual(result, PastryItem.AddPastryItem()); }
public void AddTestItem_FourPastryItems_int() { Pastry PastryItem = new Pastry(4); int result = 7; Assert.AreEqual(result, PastryItem.AddPastryItem()); }
public static void Main() { Console.WriteLine("Welcome to the Bakery! Would you like to order [bread] or [pastries]?", Color.Pink); string userResponse = Console.ReadLine().ToLower(); if (userResponse.Contains("bread")) { Console.WriteLine("How much bread would you like?"); int breadOrder = int.Parse(Console.ReadLine()); Bread myBread = new Bread(breadOrder); myBread.TheBreadAmount(); Console.WriteLine("Your total cost is " + "$" + myBread.BreadPrice); Console.WriteLine("Thank your for your business!"); } else if (userResponse.Contains("pastries")) { Console.WriteLine("How many pastries would you like?"); int pastryOrder = int.Parse(Console.ReadLine()); Pastry myPastry = new Pastry(pastryOrder); myPastry.ThePastryAmount(); Console.WriteLine("Your total cost is " + "$" + myPastry.PastryPrice); Console.WriteLine("Thank your for your business!"); } else if (userResponse != "bread" || userResponse != "pastries") { Console.WriteLine("Get out of here!"); } }
public void IsFreshPastry(int pastryId) { Pastry pastry = GetPastry(pastryId); bool isFresh = DateTime.Today.Subtract(pastry.DateOfManufacture).TotalDays <= pastry.ShelfLife; OperationContext.Current.GetCallbackChannel <IDuplexFreshnessControlCallback>().SendResult(isFresh); }
public bool IsFresh(int id) { Pastry pastry = GetPastry(id); bool isFresh = DateTime.Today.Subtract(pastry.DateOfManufacture).TotalDays <= pastry.ShelfLife; return(isFresh); }
public void PastryCost_GetCorrectCostOfMultiplePastry_Int() { int testPastry = 7; int testPastryCost = Pastry.PastryCost(testPastry); Assert.AreEqual(12, testPastryCost); }
public void PastryQuantity_VerifyQuantityNullValue_Int() { Pastry newPastry = new Pastry(); newPastry.AddItems(0); Assert.AreEqual(0, newPastry.Quantity); }
public async Task <IActionResult> PutPastry(int id, Pastry pastry) { if (id != pastry.Id) { return(BadRequest()); } PastryRepository.Update(pastry); try { await PastryRepository.SaveChangesAsync(); } catch (DbUpdateConcurrencyException) { if (!await PastryExists(id)) { return(NotFound()); } else { throw; } } return(NoContent()); }
public void GetType_ReturnsTypeOfPastryObject_string() { Pastry newPastry = new Pastry("Donut"); string testString = "Donut"; Assert.AreEqual(testString, newPastry.Type); }
public void Pastry_StorePasterOrder_Pastry() { int numberOfPastries = 5; Pastry pastryOrder = new Pastry(numberOfPastries); Assert.AreEqual(5, pastryOrder.NumberOfPastries); }
public void GetPrice_ReturnsPriceOfPastryObject_decimal() { Pastry newPastry = new Pastry("Donut"); decimal testNumber = 2; Assert.AreEqual(testNumber, newPastry.Price); }
public void PastryCost_BuyOne_1and2() { Pastry newPastry = new Pastry(1); Assert.AreEqual(1, newPastry.PastryCost()[0]); Assert.AreEqual(2, newPastry.PastryCost()[1]); }
static void Main(string[] args) { Cake cake = new Cake(); PrintProductDetails(cake); CreamDecorator creameDecorator = new CreamDecorator(cake); PrintProductDetails(creameDecorator); CherryDecorator cherryDecorator = new CherryDecorator(creameDecorator); PrintProductDetails(cherryDecorator); ArtificialScentDecorator artificialScentDecorator = new ArtificialScentDecorator(cherryDecorator); PrintProductDetails(artificialScentDecorator); // Lets now create a simple Pastry Pastry pastry = new Pastry(); PrintProductDetails(pastry); // Lets just add cream and cherry only on the pastry CreamDecorator creamPastry = new CreamDecorator(pastry); CherryDecorator cherryPastry = new CherryDecorator(creamPastry); PrintProductDetails(cherryPastry); Console.Read(); }
public void PastryCost_BuyFiveWithDiscount_5and9() { Pastry newPastry = new Pastry(5); Assert.AreEqual(5, newPastry.PastryCost()[0]); Assert.AreEqual(9, newPastry.PastryCost()[1]); }
static void Main() { Console.WriteLine("~ Welcome to Pierre's Bakery! ~"); Console.WriteLine("~ One loaf of bread: $5. *Pierre's Deal: Buy two, get one free!* ~"); Console.WriteLine("~ One pastry: $2. *Pierre's Deal: Buy three pastries for $5!* ~"); Console.WriteLine("How many loaves of bread would you like to purchase?"); string breadInput = Console.ReadLine(); Console.WriteLine("How many pastries would you like to purchase?"); string pastryInput = Console.ReadLine(); Regex regex = new Regex(@"^[0-9]+$"); Match breadMatch = regex.Match(breadInput); Match pastryMatch = regex.Match(pastryInput); if (breadMatch.Success && pastryMatch.Success) { int loaves = int.Parse(breadInput); Bread bread = new Bread(); int breadPrice = bread.CalcPrice(loaves); int pastries = int.Parse(pastryInput); Pastry pastry = new Pastry(); int pastryPrice = pastry.CalcPrice(pastries); int totalPrice = breadPrice + pastryPrice; Console.WriteLine("Your total price: $" + totalPrice); } else { Console.WriteLine("---------------------------------------"); Console.WriteLine("Numerical input only. Please try again."); Console.WriteLine("---------------------------------------"); Main(); } }
public void OrderCost_CalculatesCostOfPastryOrderWithDeal_Int() { Pastry newOrder = new Pastry(5); int result = newOrder.OrderCost(); Assert.AreEqual(9, result); }
public static void Main() { Console.WriteLine("Welcome to Le Boulangerie. Today we are offering loaves of bread for $5 or Buy 2 get 1 Free. We also have pastries. These are $2 each or 3 for $5"); Console.WriteLine("Would you like to make a purchase? If so click '1' "); string response = Console.ReadLine(); if (response == "1") { Console.WriteLine("Please enter the amount of bread you would like."); string quantityBread = Console.ReadLine(); int intBread = Convert.ToInt32(quantityBread); Bread breadOrder = new Bread(intBread); int priceBread = breadOrder.CalculateBreadPrice(intBread); Console.WriteLine("You have ordered " + intBread + " loaves of bread. This totals:$ " + priceBread); Console.WriteLine("Would you like to order any pastries? If so, click 2"); string continueOrder = Console.ReadLine(); if (continueOrder == "2") { Console.WriteLine("How many pastries would you like?"); string quantityPastry = Console.ReadLine(); int intPastry = Convert.ToInt32(quantityPastry); Pastry pastryOrder = new Pastry(intPastry); int pricePastry = pastryOrder.CalculatePastryPrice(intPastry); Console.WriteLine("You have ordered " + intBread + " loaves of bread. As well as " + quantityPastry + "Pastries. This totals:$ " + (priceBread + pricePastry)); } else { Console.WriteLine("Thanks for your order!"); } } else { Console.WriteLine("Thanks for stopping by!"); } }
public void PastryTotal_CalculatePastryTotalOfFiveWithDiscount_Int() { int quantity = 5; Pastry newPastry = new Pastry(quantity); Assert.AreEqual(9, newPastry.PastryTotal(quantity)); }
public void PastryCost_GetCorrectCostOfOnePastry_Int() { int testPastry = 1; int testPastryCost = Pastry.PastryCost(testPastry); Assert.AreEqual(2, testPastryCost); }
public void Pastry_CreatesInstanceOfPastryTotal_Int() { Pastry newPastry = new Pastry(1); int result = newPastry.Total; Assert.AreEqual(0, result); }
public static void Main() { Console.WriteLine(@" Welcome to Pierre's Bakery! Family owned and all organic. Bread is $5, or buy two and get one free! A Pastry is $2, unless you want three and you'll get em for $5! (what a deal) "); Console.WriteLine("How many loaves of bread would you like?"); int loafInput = int.Parse(Console.ReadLine()); Console.WriteLine("And how many pastries would you like?"); int pastryInput = int.Parse(Console.ReadLine()); Bread breadTotal = new Bread(loafInput); Pastry pastryTotal = new Pastry(pastryInput); int finalTotal = breadTotal.TotalBreadPrice() + pastryTotal.TotalPastryPrice(); Console.WriteLine(@" Your total will be: $" + finalTotal + ".00" + @" Have a lovely day! "); }