Advertisement
miglenabs

Untitled

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