EmoRz

07. Fruit Shop

Jun 29th, 2016
125
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 2.75 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 FruitShop
  8. {
  9. class Program
  10. {
  11. static void Main(string[] args)
  12. {
  13. var fruit = Console.ReadLine().ToLower();
  14. var day = Console.ReadLine().ToLower();
  15. var quantity = double.Parse(Console.ReadLine());
  16.  
  17. if(day =="monday"||day=="tuesday"||day=="wednesday"||day=="thursday"||day=="friday")
  18. {
  19. if (fruit == "banana")
  20. {
  21. quantity *= 2.5;
  22. }
  23. else if (fruit == "apple")
  24. {
  25. quantity *=1.2;
  26. }
  27. else if (fruit == "orange")
  28. {
  29. quantity*=0.85;
  30. }
  31.  
  32. else if (fruit == "grapefruit")
  33. {
  34. quantity*=1.45;
  35. }
  36. else if (fruit == "kiwi")
  37. {
  38. quantity*=2.7;
  39. }
  40. else if(fruit=="pineapple")
  41. {
  42. quantity*=5.5;
  43. }
  44. else if(fruit=="grapes")
  45. {
  46. quantity*=3.85;
  47. }
  48. if (quantity >= 0)
  49. Console.WriteLine("{0:f2}", quantity);
  50. else
  51. Console.WriteLine("error");
  52.  
  53. }
  54. else
  55. {
  56. Console.WriteLine("error");
  57. }
  58. if(day=="saturday"||day=="sunday")
  59. {
  60. if (fruit == "banana")
  61. {
  62. quantity *=2.7;
  63. }
  64. else if (fruit == "apple")
  65.  
  66. {
  67. quantity*=1.25;
  68. }
  69. else if (fruit == "orange")
  70. {
  71. quantity*=0.9;
  72. }
  73. else if (fruit == "grapefruit")
  74. {
  75. quantity*=1.6;
  76. }
  77. else if (fruit == "kiwi")
  78. {
  79. quantity*=3;
  80. }
  81. else if (fruit == "pineapple")
  82. {
  83. quantity*=5.60;
  84. }
  85. else if (fruit == "grapes")
  86. {
  87. quantity*=4.20;
  88. }
  89. if(quantity>=0)
  90. Console.WriteLine("{0:f2}",quantity);
  91. else
  92. Console.WriteLine("error");
  93. }
  94. else
  95. {
  96. Console.WriteLine("error");
  97. }
  98. }
  99.  
  100. }
  101. }
Advertisement
Add Comment
Please, Sign In to add comment