Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- using System;
- namespace BobiZadacha
- {
- class Program
- {
- static void Main(string[] args)
- {
- double totalMoneySpent = 0;
- int clientsCount = int.Parse(Console.ReadLine());
- for (int i = 0; i < clientsCount; i++)
- {
- int currentBuyerItemsBought = 0;
- double currentBuyerBill = 0;
- while (true)
- {
- string input = Console.ReadLine();
- if(input == "Finish")
- {
- break;
- }
- if(input == "basket")
- {
- currentBuyerBill += 1.50;
- currentBuyerItemsBought++;
- }
- else if(input == "wreath")
- {
- currentBuyerBill += 3.80;
- currentBuyerItemsBought++;
- }
- else if(input == "chocolate bunny")
- {
- currentBuyerBill += 7.00;
- currentBuyerItemsBought++;
- }
- }
- if(currentBuyerItemsBought % 2 == 0)
- {
- currentBuyerBill *= 0.8;
- }
- totalMoneySpent += currentBuyerBill;
- Console.WriteLine($"You purchased {currentBuyerItemsBought} items for {currentBuyerBill:f2} leva.");
- }
- double averageBill = totalMoneySpent / clientsCount;
- Console.WriteLine($"Average bill per client is: {averageBill} leva.");
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement