Advertisement
niksan878

Untitled

Apr 14th, 2014
167
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 6.63 KB | None | 0 0
  1. using System;
  2. using System.Collections.Generic;
  3. using System.Linq;
  4. using System.Text;
  5.  
  6. class Program
  7. {
  8. static void Main()
  9. {
  10. string dayOfWeek = Console.ReadLine();
  11. decimal quantity1 = decimal.Parse(Console.ReadLine());
  12. string product1 = Console.ReadLine();
  13. decimal quantity2 = decimal.Parse(Console.ReadLine());
  14. string product2 = Console.ReadLine();
  15. decimal quantity3 = decimal.Parse(Console.ReadLine());
  16. string product3 = Console.ReadLine();
  17.  
  18. decimal priceBanana = 1.80m;
  19. decimal priceCucumber = 2.75m;
  20. decimal priceTomato = 3.20m;
  21. decimal priceOrange = 1.60m;
  22. decimal priceApple = 0.86m;
  23.  
  24. decimal total = 0;
  25.  
  26. decimal currPrice1 = 0;
  27. decimal currPrice2 = 0;
  28. decimal currPrice3 = 0;
  29.  
  30. if (product1 == "banana" && dayOfWeek == "Tuesday")
  31. {
  32. currPrice1 = priceBanana-(priceBanana*0.2m);
  33. }
  34. else if (product1 == "banana" && dayOfWeek=="Thursday")
  35. {
  36. currPrice1 = priceBanana-(priceBanana*0.3m);
  37. }
  38. else if (product1 == "banana")
  39. {
  40. currPrice1 = priceBanana;
  41. }
  42. else if (product1 == "cucumber"&& dayOfWeek=="Wednesday")
  43. {
  44. currPrice1 = priceCucumber - (priceCucumber * 0.1m);
  45. }
  46. else if (product1 == "cucumber")
  47. {
  48. currPrice1 = priceCucumber;
  49. }
  50. else if (product1 == "tomato" && dayOfWeek=="Wednesday")
  51. {
  52. currPrice1 = priceTomato - (priceTomato - 0.1m);
  53. }
  54. else if (product1 == "tomato")
  55. {
  56. currPrice1 = priceTomato;
  57. }
  58. else if (product1 == "orange"&& dayOfWeek=="Tuesday")
  59. {
  60. currPrice1 = priceOrange - (priceOrange * 0.2m);
  61. }
  62. else if (product1 == "orange")
  63. {
  64. currPrice1 = priceOrange;
  65. }
  66. else if (product1 == "apple" && dayOfWeek=="Tuesday")
  67. {
  68. currPrice1 = priceApple - (priceApple * 0.2m);
  69. }
  70. else if (product1 == "apple")
  71. {
  72. currPrice1 = priceApple;
  73. }
  74.  
  75.  
  76.  
  77.  
  78. if (product2 == "banana" && dayOfWeek == "Tuesday")
  79. {
  80. currPrice2 = priceBanana - (priceBanana * 0.2m);
  81. }
  82. else if (product2 == "banana" && dayOfWeek == "Thursday")
  83. {
  84. currPrice2 = priceBanana - (priceBanana * 0.3m);
  85. }
  86. else if (product2 == "banana")
  87. {
  88. currPrice2 = priceBanana;
  89. }
  90. else if (product2 == "cucumber" && dayOfWeek == "Wednesday")
  91. {
  92. currPrice2 = priceCucumber - (priceCucumber * 0.1m);
  93. }
  94. else if (product2 == "cucumber")
  95. {
  96. currPrice2 = priceCucumber;
  97. }
  98. else if (product2 == "tomato" && dayOfWeek == "Wednesday")
  99. {
  100. currPrice2 = priceTomato - (priceTomato - 0.1m);
  101. }
  102. else if (product2 == "tomato")
  103. {
  104. currPrice2 = priceTomato;
  105. }
  106. else if (product2 == "orange" && dayOfWeek == "Tuesday")
  107. {
  108. currPrice2 = priceOrange - (priceOrange * 0.2m);
  109. }
  110. else if (product2 == "orange")
  111. {
  112. currPrice2 = priceOrange;
  113. }
  114. else if (product2 == "apple" && dayOfWeek == "Tuesday")
  115. {
  116. currPrice2 = priceApple - (priceApple * 0.2m);
  117. }
  118. else if (product2 == "apple")
  119. {
  120. currPrice2 = priceApple;
  121. }
  122.  
  123.  
  124.  
  125. if (product3 == "banana" && dayOfWeek == "Tuesday")
  126. {
  127. currPrice3 = priceBanana - (priceBanana * 0.2m);
  128. }
  129. else if (product3 == "banana" && dayOfWeek == "Thursday")
  130. {
  131. currPrice3 = priceBanana - (priceBanana * 0.3m);
  132. }
  133. else if (product3 == "banana")
  134. {
  135. currPrice3 = priceBanana;
  136. }
  137. else if (product3 == "cucumber" && dayOfWeek == "Wednesday")
  138. {
  139. currPrice3 = priceCucumber - (priceCucumber * 0.1m);
  140. }
  141. else if (product3 == "cucumber")
  142. {
  143. currPrice3 = priceCucumber;
  144. }
  145. else if (product3 == "tomato" && dayOfWeek == "Wednesday")
  146. {
  147. currPrice3 = priceTomato - (priceTomato - 0.1m);
  148. }
  149. else if (product3 == "tomato")
  150. {
  151. currPrice3 = priceTomato;
  152. }
  153. else if (product3 == "orange" && dayOfWeek == "Tuesday")
  154. {
  155. currPrice3 = priceOrange - (priceOrange * 0.2m);
  156. }
  157. else if (product3 == "orange")
  158. {
  159. currPrice3 = priceOrange;
  160. }
  161. else if (product3 == "apple" && dayOfWeek == "Tuesday")
  162. {
  163. currPrice3 = priceApple - (priceApple * 0.2m);
  164. }
  165. else if (product3 == "apple")
  166. {
  167. currPrice3 = priceApple;
  168. }
  169.  
  170.  
  171. switch (dayOfWeek)
  172. {
  173. case "Friday":
  174. total = quantity1 * currPrice1 + quantity2 * currPrice2 + quantity3 * currPrice3 - ((quantity1 * currPrice1 + quantity2 * currPrice2 + quantity3 * currPrice3) * 0.1m);
  175. Console.WriteLine("{0:F2}", total);
  176. break;
  177. case "Sunday":
  178. total = quantity1 * currPrice1 + quantity2 * currPrice2 + quantity3 * currPrice3 - ((quantity1 * currPrice1 + quantity2 * currPrice2 + quantity3 * currPrice3) * 0.05m);
  179. Console.WriteLine("{0:F2}", total);
  180. break;
  181. case "Tuesday":
  182. total = quantity1 * currPrice1 + quantity2 * currPrice2 + quantity3 * currPrice3;
  183. Console.WriteLine("{0:F2}", total);
  184. break;
  185. case "Wednesday":
  186. total = quantity1 * currPrice1 + quantity2 * currPrice2 + quantity3 * currPrice3;
  187. Console.WriteLine("{0:F2}", total);
  188. break;
  189. case "Thursday":
  190. total = quantity1 * currPrice1 + quantity2 * currPrice2 + quantity3 * currPrice3;
  191. Console.WriteLine("{0:F2}", total);
  192. break;
  193. case "Monday":
  194. total = quantity1 * currPrice1 + quantity2 * currPrice2 + quantity3 * currPrice3;
  195. Console.WriteLine("{0:F2}", total);
  196. break;
  197. case "Saturday":
  198. total = quantity1 * currPrice1 + quantity2 * currPrice2 + quantity3 * currPrice3;
  199. Console.WriteLine("{0:F2}", total);
  200. break;
  201. default:
  202. break;
  203. }
  204.  
  205. }
  206. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement