Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- using System;
- namespace P06_BakingCompetition
- {
- class P06_BakingCompetition
- {
- static void Main(string[] args)
- {
- int bakers = int.Parse(Console.ReadLine());
- double totalSum = 0.0;
- int totalSweetsCnt = 0;
- for (int i = 0; i < bakers; i++)
- {
- string bakerName = Console.ReadLine();
- int cookiesCnt = 0;
- int cakesCnt = 0;
- int wafflesCnt = 0;
- string sweetName = Console.ReadLine();
- while ("Stop baking!" != sweetName)
- {
- int sweetsCnt = int.Parse(Console.ReadLine());
- switch (sweetName)
- {
- case "cookies":
- cookiesCnt += sweetsCnt;
- break;
- case "cakes":
- cakesCnt += sweetsCnt;
- break;
- case "waffles":
- wafflesCnt += sweetsCnt;
- break;
- }
- sweetName = Console.ReadLine();
- }
- totalSum += ((cookiesCnt * 1.5) + (cakesCnt * 7.8) + (wafflesCnt * 2.3));
- totalSweetsCnt += (cookiesCnt + cakesCnt + wafflesCnt);
- Console.WriteLine($"{bakerName} baked {cookiesCnt} cookies, {cakesCnt} cakes and {wafflesCnt} waffles.");
- }
- Console.WriteLine($"All bakery sold: {totalSweetsCnt}");
- Console.WriteLine($"Total sum for charity: {totalSum:F2} lv.");
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement