Advertisement
Guest User

Untitled

a guest
Feb 24th, 2020
60
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 3.93 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 * priceForpineapple;
  68. Console.WriteLine($"{totalPrice:F2}");
  69. }
  70.  
  71.  
  72. }
  73. else if (dayOfweek == "Saturday" || dayOfweek == "Sunday")
  74. {
  75. if (fruit == "apple")
  76. {
  77. totalPrice = quantity * priceForappleW;
  78. Console.WriteLine($"{totalPrice:F2}");
  79. }
  80. if (fruit == "orange")
  81. {
  82. totalPrice = quantity * priceFororangeW;
  83. Console.WriteLine($"{totalPrice:F2}");
  84. }
  85. if (fruit == "grapefruit")
  86. {
  87. totalPrice = quantity * priceForgrapefruitW;
  88. Console.WriteLine($"{totalPrice:F2}");
  89. }
  90. if (fruit == "kiwi")
  91. {
  92. totalPrice = quantity * priceForkiwiW;
  93. Console.WriteLine($"{totalPrice:F2}");
  94. }
  95. if (fruit == "pineapple")
  96. {
  97. totalPrice = quantity * priceForpineappleW;
  98. Console.WriteLine($"{totalPrice:F2}");
  99. }
  100. if (fruit == "grapes")
  101. {
  102. totalPrice = quantity * priceForgrapes;
  103. Console.WriteLine($"{totalPrice:F2}");
  104. }
  105.  
  106. }
  107.  
  108. else
  109. {
  110. Console.WriteLine("error");
  111. }
  112. }
  113. }
  114. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement