Advertisement
Guest User

Untitled

a guest
Oct 23rd, 2019
98
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.53 KB | None | 0 0
  1. using System;
  2.  
  3. namespace cockieFactory
  4. {
  5. class Program
  6. {
  7. static void Main(string[] args)
  8. {
  9. int numCockies = int.Parse(Console.ReadLine());
  10.  
  11.  
  12.  
  13. string product = "";
  14. bool flour = false;
  15. bool eggs = false;
  16. bool sugar = false;
  17. bool isBake = false;
  18.  
  19. for (int i = 1; i <= numCockies; i++)
  20. {
  21.  
  22. while (!isBake)
  23. {
  24. product = Console.ReadLine();
  25. switch (product)
  26. {
  27. case "flour": flour = true; break;
  28. case "eggs": eggs = true; break;
  29. case "sugar": sugar = true; break;
  30. case "Bake!":
  31.  
  32. if (eggs && flour && sugar)
  33. {
  34. isBake = true;
  35. Console.WriteLine($"Baking batch number {i}...");
  36. flour = false;
  37. eggs = false;
  38. sugar = false;
  39. }
  40. else
  41. {
  42. Console.WriteLine("The batter should contain flour, eggs and sugar!");
  43. }
  44.  
  45. break;
  46. }
  47.  
  48.  
  49.  
  50. }
  51. isBake = false;
  52.  
  53.  
  54.  
  55. }
  56. }
  57. }
  58. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement