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