Advertisement
Guest User

ss

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