Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- using System;
- using System.Threading;
- class Program
- {
- static void Main()
- {
- int numOfCustomers = int.Parse(Console.ReadLine());
- double totalMoneySpent = 0;
- for (int i = 0; i < numOfCustomers; i++)
- {
- int itemsCounter = 0;
- double total = 0;
- string item = Console.ReadLine();
- while (item != "Finish")
- {
- itemsCounter++;
- switch (item)
- {
- case "basket":
- total += 1.50;
- break;
- case "wreath":
- total += 3.80;
- break;
- case "chocolate bunny":
- total += 7;
- break;
- }
- item = Console.ReadLine();
- }
- if (itemsCounter % 2 == 0)
- {
- total -= total * 0.20;
- }
- totalMoneySpent += total;
- Console.WriteLine($"You purchased {itemsCounter} items for {total:f2} leva.");
- }
- double average = totalMoneySpent / numOfCustomers;
- Console.WriteLine($"Average bill per client is: {average:f2} leva.");
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement