Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- using System;
- namespace _06.EasterDecoration
- {
- class EasterDecoration
- {
- static void Main(string[] args)
- {
- int clients = int.Parse(Console.ReadLine());
- double totalPrice = 0.0;
- for (int i = 0; i < clients; i++)
- {
- string command = Console.ReadLine();
- double price = 0.0;
- int productCount = 0;
- while (command != "Finish")
- {
- productCount++;
- if (command == "basket")
- {
- price += 1.50;
- }
- else if (command == "wreath")
- {
- price += 3.80;
- }
- else if (command == "chocolate bunny")
- {
- price += 7;
- }
- command = Console.ReadLine();
- }
- if (productCount % 2 == 0)
- {
- double discount = price * 0.2;
- price -= discount;
- }
- Console.WriteLine($"You purchased {productCount} items for {price:F2} leva.");
- totalPrice += price;
- }
- Console.WriteLine($"Average bill per client is: {totalPrice / clients:F2} leva.");
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement