Advertisement
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 _6.BakingCompetition
- {
- class Program
- {
- static void Main(string[] args)
- {
- int n = int.Parse(Console.ReadLine());
- int counterCookies = 0;
- int counterCakes = 0;
- int counterWaffles = 0;
- int allBakerSold = 0;
- double totalSumCharity = 0;
- for (int i = 1; i <= n; i++)
- {
- string bakerName = Console.ReadLine();
- string typeSweets = Console.ReadLine();
- while (typeSweets!= "Stop baking!")
- {
- int quantitySweets = int.Parse(Console.ReadLine());
- switch (typeSweets)
- {
- case "cookies": counterCookies += quantitySweets;totalSumCharity=totalSumCharity+quantitySweets*1.5 ; break;
- case "cakes": counterCakes += quantitySweets; totalSumCharity = totalSumCharity + quantitySweets * 7.8; break;
- case "waffles": counterWaffles += quantitySweets; totalSumCharity = totalSumCharity + quantitySweets * 2.3; break;
- }
- typeSweets = Console.ReadLine();
- }
- Console.WriteLine($"{bakerName} baked {counterCookies} cookies, {counterCakes} cakes and {counterWaffles} waffles.");
- allBakerSold = allBakerSold+counterCakes + counterCookies + counterWaffles;
- counterCakes = 0;
- counterCookies = 0;
- counterWaffles = 0;
- }
- Console.WriteLine($"All bakery sold: {allBakerSold}");
- Console.WriteLine($"Total sum for charity: {totalSumCharity:f2} lv.");
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement