mattnguyen

Untitled

Mar 2nd, 2021
80
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 2.95 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. else if (fruit == "apple")
  23. {
  24. totalPrice = quantity * 1.2;
  25. }
  26. else if (fruit == "orange")
  27. {
  28. totalPrice = quantity * 0.85;
  29. }
  30. else if (fruit == "grapefruit")
  31. {
  32. totalPrice = quantity * 1.45;
  33. }
  34. else if (fruit == "kiwi")
  35. {
  36. totalPrice = quantity * 2.7;
  37. }
  38. else if (fruit == "pineapple")
  39. {
  40. totalPrice = quantity * 5.5;
  41. }
  42. else if (fruit == "grapes")
  43. {
  44. totalPrice = quantity * 3.85;
  45. }
  46.  
  47. else
  48. {
  49. Console.WriteLine("error");
  50. }
  51.  
  52. Console.WriteLine($"{totalPrice:f2}");
  53. }
  54.  
  55.  
  56.  
  57.  
  58.  
  59.  
  60.  
  61. else if (dayOfTheWeek == "Saturday" || dayOfTheWeek == "Sunday")
  62. {
  63. if (fruit == "banana")
  64. {
  65. totalPrice = quantity * 2.7;
  66. }
  67. else if (fruit == "apple")
  68. {
  69. totalPrice = quantity * 1.25;
  70. }
  71. else if (fruit == "orange")
  72. {
  73. totalPrice = quantity * 0.9;
  74. }
  75. else if (fruit == "grapefruit")
  76. {
  77. totalPrice = quantity * 1.6;
  78. }
  79. else if (fruit == "kiwi")
  80. {
  81. totalPrice = quantity * 3;
  82. }
  83. else if(fruit == "pineapple")
  84. {
  85. totalPrice = quantity * 5.6;
  86. }
  87. else if (fruit == "grapes")
  88. {
  89. totalPrice = quantity * 4.2;
  90. }
  91.  
  92. else
  93. {
  94. Console.WriteLine("error");
  95. }
  96.  
  97. Console.WriteLine($"{totalPrice:f2}");
  98.  
  99. }
  100.  
  101. else
  102. {
  103.  
  104. Console.WriteLine("error");
  105.  
  106. }
  107. }
  108.  
  109. }
  110. }
  111.  
  112.  
Advertisement
Add Comment
Please, Sign In to add comment