Advertisement
Guest User

Untitled

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