Advertisement
Guest User

Cookie factory

a guest
Nov 17th, 2019
115
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C# 1.47 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.             for (int i = 0; i < batchCount; i++)
  12.             {
  13.                 string ingrediant = Console.ReadLine();
  14.                 bool hasFlour = false;
  15.                 bool hasEggs = false;
  16.                 bool hasSugar = false;
  17.                 bool hasAllIngredians = false;
  18.  
  19.                 while (ingrediant!="Bake!" || hasAllIngredians!=true)
  20.                 {
  21.  
  22.                     switch (ingrediant)
  23.                     {
  24.                         case "flour":
  25.                             hasFlour = true;
  26.                             break;
  27.                         case "eggs":
  28.                             hasEggs = true;
  29.                             break;
  30.                         case "sugar":
  31.                             hasSugar = true;
  32.                             break;
  33.                    
  34.                     }
  35.                      hasAllIngredians = hasFlour && hasEggs && hasSugar;
  36.                     if (ingrediant=="Bake!")
  37.                     {
  38.                         Console.WriteLine($"The batter should contain flour, eggs and sugar!");
  39.  
  40.                     }
  41.                     ingrediant = Console.ReadLine();
  42.                 }
  43.  
  44.                     Console.WriteLine($"Baking batch number {i+1}...");
  45.  
  46.              
  47.             }
  48.         }
  49.     }
  50. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement