Mucunata101

Untitled

Apr 1st, 2017
151
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 5.41 KB | None | 0 0
  1. using System;
  2. using System.Collections.Generic;
  3. using System.Linq;
  4. using System.Text;
  5. using System.Threading.Tasks;
  6.  
  7. namespace fruitShop
  8. {
  9. class Program
  10. {
  11. static void Main(string[] args)
  12. {
  13. {
  14. string fruits = Console.ReadLine().ToLower();
  15. string dayOfWeek = Console.ReadLine().ToLower();
  16. double quantity = double.Parse(Console.ReadLine());
  17.  
  18. double price = 0;
  19.  
  20.  
  21. if (dayOfWeek == "monday" || dayOfWeek == "tuesday" || dayOfWeek == "wednesday" || dayOfWeek == "thursday" ||
  22. dayOfWeek == "friday")
  23. {
  24. if (fruits == "banana") price = 2.50;
  25. {
  26. price = 2.50 * quantity;
  27. if (price >= 0)
  28. {
  29. Console.WriteLine("{0:f2}", price * quantity);
  30. }
  31. }
  32. }
  33.  
  34. else if (fruits == "apple") price = 1.20;
  35. {
  36. price = 1.20 * quantity;
  37. if (price >= 0)
  38. {
  39. Console.WriteLine("{0:f2}", price * quantity);
  40. }
  41. }
  42.  
  43.  
  44. else if (fruits == "orange") price = 0.85;
  45. {
  46. price = 0.85 * quantity;
  47. if (price >= 0)
  48. {
  49. Console.WriteLine("{0:f2}", price * quantity);
  50. }
  51. }
  52.  
  53. else if (fruits == "grapefruit") price = 1.45;
  54. {
  55. price = 1.45 * quantity;
  56. if (price >= 0)
  57. {
  58. Console.WriteLine("{0:f2}", price * quantity);
  59. }
  60. }
  61.  
  62.  
  63. else if (fruits == "kiwi") price = 2.70;
  64. {
  65. price = 2.70 * quantity;
  66. if (price >= 0)
  67. {
  68. Console.WriteLine("{0:f2}", price * quantity);
  69. }
  70. }
  71. else if (fruits == "pineapple") price = 5.50;
  72. {
  73. price = 5.50 * quantity;
  74. if (price >= 0)
  75. {
  76. Console.WriteLine("{0:f2}", price * quantity);
  77. }
  78. }
  79. else if (fruits == "grapes") price = 3.85;
  80. {
  81. price = 3.85 * quantity;
  82. if (price >= 0)
  83. {
  84. Console.WriteLine("{0:f2}", price * quantity);
  85. }
  86. else
  87. {
  88. Console.WriteLine("error");
  89. }
  90. }
  91.  
  92. else if (dayOfWeek == "saturday" || dayOfWeek == "sunday")
  93. {
  94. if (fruits == "banana") price = 2.70;
  95. {
  96. price = 2.70 * quantity;
  97. if (price >= 0)
  98. {
  99. Console.WriteLine("{0:f2}", price * quantity);
  100. }
  101.  
  102. }
  103. }
  104.  
  105. else if (fruits == "apple") price = 1.25;
  106. {
  107. price = 1.25 * quantity;
  108. if (price >= 0)
  109. {
  110. Console.WriteLine("{0:f2}", price * quantity);
  111. }
  112. }
  113. else if (fruits == "orange") price = 0.90;
  114. {
  115. price = 0.90 * quantity;
  116. if (price >= 0)
  117. {
  118. Console.WriteLine("{0:f2}", price * quantity);
  119. }
  120. }
  121.  
  122. else if (fruits == "grapefruit") price = 1.60;
  123. {
  124. price = 1.60 * quantity;
  125. if (price >= 0)
  126. {
  127. Console.WriteLine("{0:f2}", price * quantity);
  128. }
  129. }
  130.  
  131. else if (fruits == "kiwi") price = 3.00;
  132. {
  133. price = 3.00 * quantity;
  134. if (price >= 0)
  135. {
  136. Console.WriteLine("{0:f2}", price * quantity);
  137. }
  138. }
  139.  
  140. else if (fruits == "pineapple") price = 5.60;
  141. {
  142. price = 5.60 * quantity;
  143. if (price >= 0)
  144. {
  145. Console.WriteLine("{0:f2}", price * quantity);
  146. }
  147. }
  148.  
  149. else if (fruits == "grapes") price = 4.20;
  150. {
  151. price = 4.20 * quantity;
  152. if (price >= 0)
  153. {
  154. Console.WriteLine("{0:f2}", price * quantity);
  155. }
  156. }
  157. else
  158. {
  159. Console.WriteLine("error");
  160. }
  161. }
  162.  
  163. else
  164. {
  165. Console.WriteLine("error");
  166. }
  167. Console.WriteLine($"{Math.Round(price, 2)}");
  168. }
  169. }
  170. }
Advertisement
Add Comment
Please, Sign In to add comment