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