Advertisement
spasnikolov131

Untitled

Jul 21st, 2022
49
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.76 KB | None | 0 0
  1. using System;
  2.  
  3. namespace _06._Easter_Decoration
  4. {
  5. internal class Program
  6. {
  7. static void Main(string[] args)
  8. {
  9. double basket = 1.50;
  10. double wreath = 3.80;
  11. double chocolateBunny = 7;
  12.  
  13.  
  14.  
  15. double average = 0;
  16.  
  17. int countClientsInTheShop = int.Parse(Console.ReadLine());
  18.  
  19. for (int i = 1; i <= countClientsInTheShop; i++)
  20. {
  21.  
  22. double price = 0;
  23. int purchasedItems = 0;
  24. string line = Console.ReadLine();
  25. while (line != "Finish")
  26. {
  27. switch (line)
  28. {
  29. case "basket":
  30. price += basket;
  31. purchasedItems++;
  32. break;
  33. case "wreath":
  34. price += wreath;
  35. purchasedItems++;
  36. break;
  37. case "chocolate bunny":
  38. price += chocolateBunny;
  39. purchasedItems++;
  40. break;
  41.  
  42. }
  43.  
  44. line = Console.ReadLine();
  45. }
  46.  
  47. if (purchasedItems % 2 == 0)
  48.  
  49. price *= 0.80;
  50. average += price;
  51. Console.WriteLine($"You purchased {purchasedItems} items for {price:f2} leva.");
  52.  
  53.  
  54.  
  55. }
  56. average /= countClientsInTheShop;
  57. Console.WriteLine($"Average bill per client is: {average:f2} leva.");
  58.  
  59.  
  60.  
  61.  
  62.  
  63.  
  64.  
  65.  
  66.  
  67.  
  68.  
  69.  
  70.  
  71.  
  72. }
  73. }
  74. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement