Advertisement
Guest User

Untitled

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