Advertisement
Guest User

Untitled

a guest
Feb 27th, 2020
151
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 3.40 KB | None | 0 0
  1. using System;
  2.  
  3. namespace _08._Fruit_Shop
  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. if (day == "Monday" || day == "Tuesday" || day == "Wednesday" || day == "Thursday" || day == "Friday")
  14. {
  15. if (fruit == "banana")
  16. {
  17. price = 2.50;
  18. Console.WriteLine($"{price * quantity:F2}");
  19. }
  20.  
  21. else if (fruit == "apple")
  22. {
  23. price = 1.20;
  24. Console.WriteLine($"{price * quantity:F2}");
  25. }
  26.  
  27. else if (fruit == "orange")
  28. {
  29. price = 0.85;
  30. Console.WriteLine($"{price * quantity:F2}");
  31. }
  32.  
  33. else if (fruit == " grapefruit")
  34. {
  35. price = 1.45;
  36. Console.WriteLine($"{price * quantity:F2}");
  37. }
  38. else if (fruit == "kiwi")
  39. {
  40. price = 2.70;
  41. Console.WriteLine($"{price * quantity:F2}");
  42.  
  43. }
  44. else if (fruit == "pineapple")
  45. {
  46. price = 5.50;
  47. Console.WriteLine($"{price * quantity:F2}");
  48.  
  49. }
  50. else if (fruit == "grapes")
  51. {
  52. price = 3.85;
  53. Console.WriteLine($"{price * quantity:F2}");
  54. }
  55. else
  56. {
  57. Console.WriteLine("error");
  58. }
  59.  
  60.  
  61. }
  62.  
  63. else if (day == "Saturday" || day == "Sunday")
  64.  
  65. {
  66. if (fruit == "banana")
  67. {
  68. price = 2.70;
  69. Console.WriteLine($"{price * quantity:F2}");
  70. }
  71.  
  72. else if (fruit == "apple")
  73. {
  74. price = 1.25;
  75. Console.WriteLine($"{price * quantity:F2}");
  76. }
  77.  
  78. else if (fruit == "orange")
  79. {
  80. price = 0.90;
  81. Console.WriteLine($"{price * quantity:F2}");
  82. }
  83.  
  84. else if (fruit == "grapefruit")
  85. {
  86. price = 1.60;
  87. Console.WriteLine($"{price * quantity:F2}");
  88. }
  89. else if (fruit == "kiwi")
  90. {
  91. price = 3.00;
  92. Console.WriteLine($"{price * quantity:F2}");
  93.  
  94. }
  95. else if (fruit == "pineapple")
  96. {
  97. price = 5.60;
  98. Console.WriteLine($"{price * quantity:F2}");
  99.  
  100. }
  101. else if (fruit == "grapes")
  102. {
  103. price = 4.20;
  104. Console.WriteLine($"{price * quantity:F2}");
  105. }
  106. else
  107. {
  108. Console.WriteLine("error");
  109. }
  110.  
  111. }
  112.  
  113.  
  114.  
  115.  
  116.  
  117.  
  118. else
  119. {
  120. Console.WriteLine("error");
  121. }
  122.  
  123.  
  124.  
  125.  
  126.  
  127. }
  128.  
  129. }
  130. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement