mattnguyen

Untitled

Mar 2nd, 2021
75
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 2.65 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. }
  50. else if (dayOfTheWeek == "Saturday" || dayOfTheWeek == "Sunday")
  51. {
  52. if (fruit == "banana")
  53. {
  54. totalPrice = quantity * 2.7;
  55. }
  56. if (fruit == "apple")
  57. {
  58. totalPrice = quantity * 1.25;
  59. }
  60. if (fruit == "orange")
  61. {
  62. totalPrice = quantity * 0.9;
  63. }
  64. if (fruit == "grapefruit")
  65. {
  66. totalPrice = quantity * 1.6;
  67. }
  68. if (fruit == "kiwi")
  69. {
  70. totalPrice = quantity * 3;
  71. }
  72. if (fruit == "pineapple")
  73. {
  74. totalPrice = quantity * 5.6;
  75. }
  76. if (fruit == "grapes")
  77. {
  78. totalPrice = quantity * 4.2;
  79. }
  80.  
  81.  
  82. Console.WriteLine($"{totalPrice:f2}");
  83. }
  84.  
  85. else
  86. {
  87. Console.WriteLine("error");
  88. }
  89.  
  90. }
  91.  
  92. }
  93. }
  94.  
  95.  
Advertisement
Add Comment
Please, Sign In to add comment