Advertisement
em3ata

FruitShop

Aug 15th, 2019
356
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.58 KB | None | 0 0
  1. using System;
  2.  
  3. namespace fruitStore
  4. {
  5. class Program
  6. {
  7. static void Main(string[] args)
  8. {
  9. string fruit = Console.ReadLine();
  10. string day = Console.ReadLine();
  11. double quantity = double.Parse(Console.ReadLine());
  12. double price = 0;
  13. if ((day == "Monday") || (day == "Tuesday") || (day == "Wednesday") || (day == "Thursday") || (day == "Friday"))
  14. {
  15. if (fruit == "banana") price = 2.50;
  16.  
  17. else if (fruit == "apple") price = 1.20;
  18.  
  19. else if (fruit == "orange") price = 0.85;
  20.  
  21. else if (fruit == "grapefruit") price = 1.45;
  22.  
  23. else if (fruit == "kiwi") price = 2.70;
  24.  
  25. else if (fruit == "pineapple") price = 5.50;
  26.  
  27. else if (fruit == "grapes") price = 3.85;
  28.  
  29. }
  30. if ((day == "Saturday") || (day == "Sunday"))
  31. {
  32. if (fruit == "banana") price = 2.70;
  33.  
  34. else if (fruit == "apple") price = 1.25;
  35.  
  36. else if (fruit == "orange") price = 0.90;
  37.  
  38. else if (fruit == "grapefruit") price = 1.60;
  39.  
  40. else if (fruit == "kiwi") price = 3.00;
  41.  
  42. else if (fruit == "pineapple") price = 5.60;
  43.  
  44. else if (fruit == "grapes") price = 4.20;
  45.  
  46. }
  47. if (price > 0)
  48. Console.WriteLine($"{quantity * price:F2}");
  49. else
  50. {
  51. Console.WriteLine("error");
  52. }
  53. }
  54.  
  55. }
  56.  
  57. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement