Advertisement
Guest User

Untitled

a guest
Feb 24th, 2020
120
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 2.79 KB | None | 0 0
  1. using System;
  2.  
  3. namespace FruitShop
  4. {
  5. class Program
  6. {
  7. static void Main(string[] args)
  8. {
  9. //banana apple orange grapefruit kiwi pineapple grapes
  10. // 2.50 1.20 0.85 1.45 2.70 5.50 3.85
  11. string fruit = Console.ReadLine();
  12. string dayOfweek = Console.ReadLine();
  13. double quantity = double.Parse(Console.ReadLine());
  14.  
  15. double priceForbanana = 2.50;
  16. double priceForapple = 1.20;
  17. double priceFororange = 0.85;
  18. double priceForgrapefruit = 1.45;
  19. double priceForkiwi = 2.70;
  20. double priceForpineapple = 5.50;
  21. double priceForgrapes = 3.85;
  22.  
  23. double priceForbananaW = 2.70;
  24. double priceForappleW = 1.25;
  25. double priceFororangeW = 0.90;
  26. double priceForgrapefruitW = 1.60;
  27. double priceForkiwiW = 3.00;
  28. double priceForpineappleW = 5.60;
  29. double priceForgrapesW = 4.20;
  30. double totalPrice = 0;
  31. double totalPrice2 = 0;
  32.  
  33.  
  34. if (dayOfweek == "Monday" || dayOfweek == "Tuesday" || dayOfweek == "Wednesday" || dayOfweek == "Thursday" || dayOfweek == "Friday")
  35.  
  36. {
  37. if (fruit == "banana" || fruit == "apple" || fruit == "orange" || fruit == "grapefruit" || fruit == "kiwi" || fruit == "pineapple" || fruit == "grapes")
  38. {
  39. totalPrice = quantity * priceForapple;
  40. totalPrice = quantity * priceForbanana;
  41. totalPrice = quantity * priceFororange;
  42. totalPrice = quantity * priceForgrapefruit;
  43. totalPrice = quantity * priceForkiwi;
  44. totalPrice = quantity * priceForpineapple;
  45. totalPrice = quantity * priceForgrapes;
  46. Console.WriteLine($"{totalPrice:F2}");
  47. }
  48. else if (dayOfweek == "Saturday" || dayOfweek == "Sunday")
  49. {
  50. totalPrice2 = quantity * priceForappleW;
  51. totalPrice2 = quantity * priceForbananaW;
  52. totalPrice2 = quantity * priceFororangeW;
  53. totalPrice2 = quantity * priceForgrapefruitW;
  54. totalPrice2 = quantity * priceForkiwiW;
  55. totalPrice2 = quantity * priceForpineappleW;
  56. totalPrice2 = quantity * priceForgrapesW;
  57. Console.WriteLine($"{totalPrice2:F2}");
  58. }
  59. }
  60. else
  61. {
  62. Console.WriteLine("error");
  63. }
  64.  
  65.  
  66.  
  67.  
  68. }
  69. }
  70. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement