Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- using System;
- namespace _06.BakeCompetition
- {
- class Program
- {
- static void Main(string[] args)
- {
- int bakers = int.Parse(Console.ReadLine());
- //за всеки сладкар -> 1 до последния (bakers)
- int countAll = 0;
- int countAllCookies = 0;
- int countAllCakes = 0;
- int countAllWaffles = 0;
- for (int baker = 1; baker <= bakers; baker++)
- {
- string name = Console.ReadLine(); // брой сладки, брой торти, брой гофрети
- int countCookiesPerBaker = 0;
- int countCakesPerBaker = 0;
- int countWafflesPerBaker = 0;
- string type = Console.ReadLine(); //=>"Stop baking!" или тип сладкиш
- //STOP -> command == "Stop baking!" -> command != "Stop baking!"
- while (type != "Stop baking!")
- {
- //вид сладкиш -> "cookies", "cakes", "waffles"
- int count = int.Parse(Console.ReadLine());
- countAll += count;
- switch (type)
- {
- case "cookies":
- countCookiesPerBaker += count;
- countAllCookies += count;
- break;
- case "cakes":
- countCakesPerBaker += count;
- countAllCakes += count;
- break;
- case "waffles":
- countWafflesPerBaker += count;
- countAllWaffles += count;
- break;
- }
- type = Console.ReadLine();
- }
- Console.WriteLine($"{name} baked {countCookiesPerBaker} cookies, {countCakesPerBaker} cakes and {countWafflesPerBaker} waffles.");
- }
- Console.WriteLine($"All bakery sold: {countAll}");
- //СУМА = сладки(общ брой сладки * 1.5) + торти(общ брой торти * 7.80) + гофрети(общ брой гофрети * 2.30)
- double totalSum = (countAllCookies * 1.50) + (countAllCakes * 7.80) + (countAllWaffles * 2.30);
- Console.WriteLine($"Total sum for charity: {totalSum:F2} lv.");
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement