Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- using System;
- using System.Collections.Generic;
- using System.Linq;
- using System.Text;
- using System.Threading.Tasks;
- namespace _08.Cookie_factory
- {
- class Program
- {
- static void Main(string[] args)
- {
- int numberOfBatches = int.Parse(Console.ReadLine());
- string product = string.Empty;
- string flour = string.Empty;
- string eggs = string.Empty;
- string sugar = string.Empty;
- int bake = 0;
- while (bake < numberOfBatches)
- {
- product = Console.ReadLine();
- if (product == "flour")
- {
- flour = product;
- }
- else if (product == "eggs")
- {
- eggs = product;
- }
- else if (product == "sugar")
- {
- sugar = product;
- }
- if (product == "Bake!")
- {
- if (flour == string.Empty || eggs == string.Empty || sugar == string.Empty)
- {
- Console.WriteLine("The batter should contain flour, eggs and sugar!");
- }
- else
- {
- bake++;
- Console.WriteLine("Baking batch number {0}...", bake);
- flour = string.Empty;
- eggs = string.Empty;
- sugar = string.Empty;
- }
- }
- }
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment