mattnguyen

Untitled

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