Advertisement
Guest User

Untitled

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