Advertisement
Guest User

Untitled

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