Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- using System;
- namespace _06._Easter_Decoration
- {
- internal class Program
- {
- static void Main(string[] args)
- {
- double basket = 1.50;
- double wreath = 3.80;
- double chocolateBunny = 7;
- double average = 0;
- int countClientsInTheShop = int.Parse(Console.ReadLine());
- for (int i = 1; i <= countClientsInTheShop; i++)
- {
- double price = 0;
- int purchasedItems = 0;
- string line = Console.ReadLine();
- while (line != "Finish")
- {
- switch (line)
- {
- case "basket":
- price += basket;
- purchasedItems++;
- break;
- case "wreath":
- price += wreath;
- purchasedItems++;
- break;
- case "chocolate bunny":
- price += chocolateBunny;
- purchasedItems++;
- break;
- }
- line = Console.ReadLine();
- }
- if (purchasedItems % 2 == 0)
- price *= 0.80;
- average += price;
- Console.WriteLine($"You purchased {purchasedItems} items for {price:f2} leva.");
- }
- average /= countClientsInTheShop;
- Console.WriteLine($"Average bill per client is: {average:f2} leva.");
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement