Advertisement
desislava_topuzakova

Untitled

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