Stanislavgr

fruit shop

Mar 31st, 2019
194
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 2.53 KB | None | 0 0
  1. using System;
  2. using System.Collections.Generic;
  3. using System.Linq;
  4. using System.Text;
  5. using System.Threading.Tasks;
  6.  
  7. namespace _06.Fruit_Shop
  8. {
  9. class Program
  10. {
  11. static void Main(string[] args)
  12. {
  13. string fruit = Console.ReadLine();
  14. string day = Console.ReadLine();
  15. double quantity = double.Parse(Console.ReadLine());
  16. double price = 0;
  17. double totalSum = quantity * price;
  18.  
  19. if (day == "monday" || day == "tuesday" || day == "wednesday" || day == "friday" || day == "thirsday")
  20. {
  21. if (fruit == "banana")
  22. {
  23. price = 2.50;
  24. }
  25. else if (fruit == "apple")
  26. {
  27. price = 1.20;
  28. }
  29. else if (fruit == "orange")
  30. {
  31. price = 0.85;
  32. }
  33. else if (fruit == "grapefruit")
  34. {
  35. price = 1.45;
  36. }
  37. else if (fruit == "kiwi")
  38. {
  39. price = 2.70;
  40. }
  41. else if (fruit == "pineapple")
  42. {
  43. price = 5.5;
  44. }
  45. else if (fruit == "grapes")
  46. {
  47. price = 3.85;
  48. }
  49. }
  50. else if (day == "saturday" || day == "sunday")
  51. {
  52. if (fruit == "banana")
  53. {
  54. price = 2.7;
  55. }
  56. else if (fruit == "apple")
  57. {
  58. price = 1.25;
  59. }
  60. else if (fruit == "orange")
  61. {
  62. price = 0.90;
  63. }
  64. else if (fruit == "grapefruit")
  65. {
  66. price = 1.60;
  67. }
  68. else if (fruit == "kiwi")
  69. {
  70. price = 3.00;
  71. }
  72. else if (fruit == "pineapple")
  73. {
  74. price = 5.60;
  75. }
  76. else if (fruit == "grapes")
  77. {
  78. price = 4.20;
  79. }
  80. }
  81.  
  82.  
  83.  
  84. if (totalSum > 0)
  85. {
  86. Console.WriteLine($"{totalSum:f2}");
  87. }
  88. else
  89. {
  90. Console.WriteLine("error");
  91. }
  92.  
  93. }
  94. }
  95. }
Advertisement
Add Comment
Please, Sign In to add comment