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 Baking_Competition
- {
- class Program
- {
- static void Main(string[] args)
- {
- int numberPeople = int.Parse(Console.ReadLine());
- int backery = 0;
- double total = 0;
- for (int i = 0; i < numberPeople; i++)
- {
- int cookies = 0;
- int cakes = 0;
- int waffles = 0;
- string name = Console.ReadLine();
- string typeSweet = "";
- int numberBaked = 0;
- while (typeSweet != "Stop baking!")
- {
- typeSweet = Console.ReadLine();
- if (typeSweet == "Stop baking!")
- {
- break;
- }
- numberBaked = int.Parse(Console.ReadLine());
- if (typeSweet == "cookies")
- {
- cookies = numberBaked;
- }
- else if (typeSweet == "cakes")
- {
- cakes = numberBaked;
- }
- else if (typeSweet == "waffles")
- {
- waffles = numberBaked;
- }
- }
- total += cookies * 1.50 + cakes * 7.80 + waffles * 2.30;
- Console.WriteLine($"{name} baked {cookies} cookies, {cakes} cakes and {waffles} waffles.");
- backery += waffles + cakes + cookies;
- }
- Console.WriteLine($"All bakery sold: {backery}");
- Console.WriteLine($"Total sum for charity: {total:f2} lv.");
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement