Advertisement
desislava_topuzakova

Untitled

May 8th, 2020
183
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 3.89 KB | None | 0 0
  1. using System;
  2.  
  3. namespace FruitShop
  4. {
  5. class Program
  6. {
  7. static void Main(string[] args)
  8. {
  9. string fruit = Console.ReadLine();
  10. string day = Console.ReadLine();
  11. double quantity = double.Parse(Console.ReadLine());
  12. double price = 0;
  13.  
  14. if (day == "Monday" || day == "Tuesday" || day == "Wednesday" || day == "Thursday" || day == "Friday")
  15. {
  16. if (fruit == "banana")
  17. {
  18. price = 2.50 * quantity;
  19. Console.WriteLine($"{price:F2}");
  20. }
  21. else if (fruit == "apple")
  22. {
  23. price = 1.20 * quantity;
  24. Console.WriteLine($"{price:F2}");
  25. }
  26. else if (fruit == "orange")
  27. {
  28. price = 0.85 * quantity;
  29. Console.WriteLine($"{price:F2}");
  30. }
  31. else if (fruit == "grapefruit")
  32. {
  33. price = 1.45 * quantity;
  34. Console.WriteLine($"{price:F2}");
  35. }
  36. else if (fruit == "kiwi")
  37. {
  38. price = 2.70 * quantity;
  39. Console.WriteLine($"{price:F2}");
  40. }
  41. else if (fruit == "pineapple")
  42. {
  43. price = 5.5 * quantity;
  44. Console.WriteLine($"{price:F2}");
  45. }
  46. else if (fruit == "grapes")
  47. {
  48. price = 3.85 * quantity;
  49. Console.WriteLine($"{price:F2}");
  50. }
  51. else
  52. {
  53. Console.WriteLine("error");
  54. }
  55.  
  56.  
  57. }
  58. // week days:
  59. //плод banana apple orange grapefruit kiwi pineapple grapes
  60. // цена 2.50 1.20 0.85 1.45 2.70 5.50 3.85
  61.  
  62. else if (day == "Saturday" || day == "Sunday")
  63. {
  64. if (fruit == "banana")
  65. {
  66. price = 2.70 * quantity;
  67. Console.WriteLine($"{price:F2}");
  68. }
  69. else if (fruit == "apple")
  70. {
  71. price = 1.25 * quantity;
  72. Console.WriteLine($"{price:F2}");
  73. }
  74. else if (fruit == "orange")
  75. {
  76. price = 0.90 * quantity;
  77. Console.WriteLine($"{price:F2}");
  78. }
  79. else if (fruit == "grapefruit")
  80. {
  81. price = 1.60 * quantity;
  82. Console.WriteLine($"{price:F2}");
  83. }
  84. else if (fruit == "kiwi")
  85. {
  86. price = 3.00 * quantity;
  87. Console.WriteLine($"{price:F2}");
  88. }
  89. else if (fruit == "pineapple")
  90. {
  91. price = 5.6 * quantity;
  92. Console.WriteLine($"{price:F2}");
  93. }
  94. else if (fruit == "grapes")
  95. {
  96. price = 4.2 * quantity;
  97. Console.WriteLine($"{price:F2}");
  98. }
  99. else
  100. {
  101. Console.WriteLine("error");
  102. }
  103.  
  104. }
  105. else
  106. {
  107. Console.WriteLine("error");
  108. }
  109. //weekend days:
  110. //плод banana apple orange grapefruit kiwi pineapple grapes
  111. // цена 2.70 1.25 0.90 1.60 3.00 5.60 4.20
  112.  
  113.  
  114.  
  115. //Print: Резултатът да се отпечата закръглен с 2 цифри след десетичната точка.
  116. //При невалиден ден от седмицата или невалидно име на плод да се отпечата "error".
  117.  
  118.  
  119.  
  120.  
  121. }
  122.  
  123. }
  124. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement