Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- using System;
- namespace Baking_Competition
- {
- class Program
- {
- static void Main(string[] args)
- {
- int participants = int.Parse(Console.ReadLine());
- int numberBakerys = 0;
- double totalSum = 0;
- for (int i = 1; i <= participants; i++)
- {
- int cookies = 0;
- int cakes = 0;
- int waffles = 0;
- string name = Console.ReadLine();
- string bakery = Console.ReadLine();
- while (bakery != "Stop baking!")
- {
- int bakeryNumb = int.Parse(Console.ReadLine());
- if (bakery == "cookies")
- {
- cookies += bakeryNumb;
- }
- else if (bakery == "cakes")
- {
- cakes += bakeryNumb;
- }
- else if (bakery == "waffles")
- {
- waffles += bakeryNumb;
- }
- bakery = Console.ReadLine();
- }
- if (bakery == "Stop baking!")
- {
- numberBakerys += cookies + cakes + waffles;
- totalSum += cookies * 1.50 + cakes * 7.80 + waffles * 2.30;
- Console.WriteLine($"{name} baked {cookies} cookies, {cakes} cakes and {waffles} waffles.");
- }
- }
- Console.WriteLine($"All bakery sold: {numberBakerys}");
- Console.WriteLine($"Total sum for charity: {totalSum:f2} lv.");
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement