Advertisement
Guest User

Fruitz

a guest
Feb 24th, 2020
106
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 2.99 KB | None | 0 0
  1. using System;
  2.  
  3. namespace Shop2
  4. {
  5. class Program
  6. {
  7. static void Main(string[] args)
  8. {
  9. // Магазин за плодове през работните дни работи на следните цени:
  10. // плод banana apple orange grapefruit kiwi pineapple grapes
  11. // цена 2.50 1.20 0.85 1.45 2.70 5.50 3.85
  12. //Събота и неделя магазинът работи на по - високи цени:
  13. // плод banana apple orange grapefruit kiwi pineapple grapes
  14. //цена 2.70 1.25 0.90 1.60 3.00 5.60 4.20
  15. string fruits = Console.ReadLine();
  16. string day = Console.ReadLine();
  17. double kolichestvo = double.Parse(Console.ReadLine());
  18. double price = 0;
  19. if (day == "Monday" || day == "Tuesday" || day == "Wednesday" || day == "Thursday" || day == "Friday")
  20. {
  21. if (fruits == "banana")
  22. {
  23. price = 2.5;
  24. }
  25. else if (fruits == "apple")
  26. {
  27. price = 1.2;
  28. }
  29. else if (fruits == "orange")
  30. {
  31. price = 0.85;
  32. }
  33. else if (fruits == "grapefruit")
  34. {
  35. price = 1.45;
  36. }
  37. else if (fruits == "kiwi")
  38. {
  39. price = 2.70;
  40. }
  41. else if (fruits == "pineapple")
  42. {
  43. price = 5.50;
  44. }
  45. else if (fruits == "grapes")
  46. {
  47. price = 3.85;
  48. }
  49. }
  50.  
  51. else if (day == "Saturday" || day == "Sunday")
  52. {
  53.  
  54. if (fruits == "banana")
  55. {
  56. price = 2.70;
  57. }
  58. else if (fruits == "apple")
  59. {
  60. price = 1.25;
  61. }
  62. else if (fruits == "orange")
  63. {
  64. price = 0.90;
  65. }
  66. else if (fruits == "grapefruit")
  67. {
  68. price = 1.60;
  69. }
  70. else if (fruits == "kiwi")
  71. {
  72. price = 3;
  73. }
  74. else if (fruits == "pineapple")
  75. {
  76. price = 5.60;
  77. }
  78. else if (fruits == "grapes")
  79. {
  80. price = 4.20;
  81. }
  82. }
  83. if (price > 0)
  84. {
  85. Console.WriteLine("{0:F2}", price * kolichestvo);
  86. }
  87. else
  88. Console.WriteLine("error");
  89. }
  90. }
  91. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement